From a0e87c009268f7eadeb58b3a95a34e45fb973387 Mon Sep 17 00:00:00 2001 From: tonytan4ever Date: Thu, 17 May 2018 13:15:32 -0400 Subject: [PATCH 1/2] Making metadata working with ceph deployments --- playbooks/maas-pre-flight.yml | 2 +- playbooks/templates/common/macros.jinja | 12 +++++++----- .../notes/TURTLES-762-ceph-e7491abc69c94c7a.yaml | 9 +++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/TURTLES-762-ceph-e7491abc69c94c7a.yaml diff --git a/playbooks/maas-pre-flight.yml b/playbooks/maas-pre-flight.yml index 783501bcd..73f36b453 100644 --- a/playbooks/maas-pre-flight.yml +++ b/playbooks/maas-pre-flight.yml @@ -50,7 +50,7 @@ msg: >- There are missing metadata environment variable(s), as you can see 'unknown' from this test template '{{ rendered_maas_metata_test_tmpl }}'. Please set proper env - variables, possible options are: maas_env_identifier, maas_rpco_dir, maas_osa_dir + variables, possible options are: maas_env_identifier, maas_product_dir, maas_product_osa_dir when: - maas_pre_flight_metadata_check_enabled | default(true) | bool - rendered_maas_metata_test_tmpl | search('unknown') diff --git a/playbooks/templates/common/macros.jinja b/playbooks/templates/common/macros.jinja index 9fbb60c33..e398314e1 100644 --- a/playbooks/templates/common/macros.jinja +++ b/playbooks/templates/common/macros.jinja @@ -18,13 +18,15 @@ host {# we can change to hardware here if we want #} {% macro get_metadata(label) %} -{% set get_rpco_version_cmd="(cd "+maas_rpco_dir|default('/opt/rpc-openstack')+"&& git describe --tags --abbrev=0) || echo 'unknown\'" %} -{% set get_osa_version_cmd="(cd "+maas_osa_dir|default('/opt/rpc-openstack/openstack-ansible')+"&& git describe --tags --abbrev=0) || "+"(cd "+ maas_2nd_osa_dir|default('/opt/openstack-ansible')+ "&& git describe --tags --abbrev=0) || echo 'unknown\'" %} +{% set get_product_version_cmd="(cd "+maas_product_dir|default('/opt/rpc-openstack')+"&& git describe --tags --abbrev=0) || echo 'unknown\'" %} +{% set get_product_osa_version_cmd="(cd "+maas_product_osa_dir|default('/opt/rpc-openstack/openstack-ansible')+"&& git describe --tags --abbrev=0) || "+"(cd "+ maas_2nd_product_osa_dir|default('/opt/openstack-ansible')+ "&& git describe --tags --abbrev=0) || echo 'unknown\'" %} metadata : - product: "rpco" + product: "{{ maas_env_product | default('rpco') }}" rpc_env_identifier: "{{ maas_env_identifier | default('unknown')}}" - product_version: "{{ lookup('pipe', get_rpco_version_cmd )}}" - osa_version: "{{ lookup('pipe', get_osa_version_cmd )}}" + product_version: "{{ lookup('pipe', get_product_version_cmd )}}" +{% if not(maas_env_product is defined and 'ceph' in maas_env_product) %} + osa_version: "{{ lookup('pipe', get_product_osa_version_cmd )}}" +{% endif %} rpc_maas_version: "{{ lookup('pipe', 'cd .. && git describe --tags --abbrev=0') }}" rpc_maas_deploy_date: "{{ ansible_date_time.date }}" rpc_check_category: "{{ get_check_category(label).strip() }}" diff --git a/releasenotes/notes/TURTLES-762-ceph-e7491abc69c94c7a.yaml b/releasenotes/notes/TURTLES-762-ceph-e7491abc69c94c7a.yaml new file mode 100644 index 000000000..2342d3aa6 --- /dev/null +++ b/releasenotes/notes/TURTLES-762-ceph-e7491abc69c94c7a.yaml @@ -0,0 +1,9 @@ +--- + +fixes: + - | + Add an extra maas_env_product, defaults to 'rpco'. In ceph environment + it should be set to 'ceph'. Also maas_rpco_dir has been renamed to + maas_product_dir, and osa version will be left out in the case of ceph + environment + From 009b6a62cc3e27d73578fcbcd1869f6539522b8e Mon Sep 17 00:00:00 2001 From: tonytan4ever Date: Wed, 30 May 2018 10:25:24 -0500 Subject: [PATCH 2/2] Skip product version if product is osa --- playbooks/templates/common/macros.jinja | 2 ++ 1 file changed, 2 insertions(+) diff --git a/playbooks/templates/common/macros.jinja b/playbooks/templates/common/macros.jinja index e398314e1..b88ca4523 100644 --- a/playbooks/templates/common/macros.jinja +++ b/playbooks/templates/common/macros.jinja @@ -23,7 +23,9 @@ host {# we can change to hardware here if we want #} metadata : product: "{{ maas_env_product | default('rpco') }}" rpc_env_identifier: "{{ maas_env_identifier | default('unknown')}}" +{% if not(maas_env_product is defined and maas_env_product == 'osa') %} product_version: "{{ lookup('pipe', get_product_version_cmd )}}" +{% endif %} {% if not(maas_env_product is defined and 'ceph' in maas_env_product) %} osa_version: "{{ lookup('pipe', get_product_osa_version_cmd )}}" {% endif %}