From 2ff922b0dcaa46b9e72c06debc6164c2623dd9a4 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Wed, 19 Jul 2017 11:44:56 +0100 Subject: Move step_config/docker_config calculation into services.yaml Moving these means we get a more accurate output from the overcloud RoleData output, which more closely reflects what is actually deployed. Change-Id: I154f36c1597cf4abe29ca0bfe15a54f507433fb1 --- common/services.yaml | 32 +++++++++++++++++++++++++++++--- docker/docker-steps.j2 | 31 ++----------------------------- puppet/puppet-steps.j2 | 2 +- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/common/services.yaml b/common/services.yaml index 8581656e..e415f4b9 100644 --- a/common/services.yaml +++ b/common/services.yaml @@ -1,4 +1,3 @@ -#FIXME move into common when specfile adds it heat_template_version: pike description: > @@ -63,6 +62,33 @@ resources: properties: RoleData: {get_attr: [ServiceChain, role_data]} + PuppetStepConfig: + type: OS::Heat::Value + properties: + type: string + value: + yaql: + expression: + # select 'step_config' only from services that do not have a docker_config + coalesce($.data.service_names, []).zip(coalesce($.data.step_config, []), coalesce($.data.docker_config, [])).where($[2] = null).where($[1] != null).select($[1]).join("\n") + data: + service_names: {get_attr: [ServiceChain, role_data, service_name]} + step_config: {get_attr: [ServiceChain, role_data, step_config]} + docker_config: {get_attr: [ServiceChain, role_data, docker_config]} + + DockerConfig: + type: OS::Heat::Value + properties: + type: json + value: + yaql: + expression: + # select 'docker_config' only from services that have it + coalesce($.data.service_names, []).zip(coalesce($.data.docker_config, [])).where($[1] != null).select($[1]).reduce($1.mergeWith($2), {}) + data: + service_names: {get_attr: [ServiceChain, role_data, service_names]} + docker_config: {get_attr: [ServiceChain, role_data, docker_config]} + outputs: role_data: description: Combined Role data for this set of services. @@ -125,7 +151,7 @@ outputs: yaql: expression: $.data.role_data.where($ != null).select($.get('service_workflow_tasks')).where($ != null).reduce($1.mergeWith($2), {}) data: {role_data: {get_attr: [ServiceChain, role_data]}} - step_config: {get_attr: [ServiceChain, role_data, step_config]} + step_config: {get_attr: [PuppetStepConfig, value]} upgrade_tasks: yaql: # Note we use distinct() here to filter any identical tasks, e.g yum update for all services @@ -143,7 +169,7 @@ outputs: kolla_config: map_merge: {get_attr: [ServiceChain, role_data, kolla_config]} docker_config: - {get_attr: [ServiceChain, role_data, docker_config]} + {get_attr: [DockerConfig, value]} docker_puppet_tasks: {get_attr: [ServiceChain, role_data, docker_puppet_tasks]} host_prep_tasks: diff --git a/docker/docker-steps.j2 b/docker/docker-steps.j2 index 4b0c8789..316b46bb 100644 --- a/docker/docker-steps.j2 +++ b/docker/docker-steps.j2 @@ -176,10 +176,10 @@ resources: puppet_config: {get_param: [role_data, {{role.name}}, puppet_config]} docker_puppet_script: {get_file: docker-puppet.py} docker_puppet_tasks: {get_attr: [{{primary_role_name}}DockerPuppetTasks, value]} - docker_startup_configs: {get_attr: [{{role.name}}DockerConfig, value]} + docker_startup_configs: {get_param: [role_data, {{role.name}}, docker_config]} kolla_config: {get_param: [role_data, {{role.name}}, kolla_config]} bootstrap_server_id: {get_param: [servers, {{primary_role_name}}, '0']} - puppet_step_config: {get_attr: [{{role.name}}PuppetStepConfig, value]} + puppet_step_config: {get_param: [role_data, {{role.name}}, step_config]} tasks: # Join host_prep_tasks with the other per-host configuration yaql: @@ -232,33 +232,6 @@ resources: servers: {get_param: [servers, {{role.name}}]} config: {get_resource: {{role.name}}HostPrepConfig} - {{role.name}}PuppetStepConfig: - type: OS::Heat::Value - properties: - type: string - value: - yaql: - expression: - # select 'step_config' only from services that do not have a docker_config - $.data.service_names.zip($.data.step_config, $.data.docker_config).where($[2] = null).where($[1] != null).select($[1]).join("\n") - data: - service_names: {get_param: [role_data, {{role.name}}, service_names]} - step_config: {get_param: [role_data, {{role.name}}, step_config]} - docker_config: {get_param: [role_data, {{role.name}}, docker_config]} - - {{role.name}}DockerConfig: - type: OS::Heat::Value - properties: - type: json - value: - yaql: - expression: - # select 'docker_config' only from services that have it - $.data.service_names.zip($.data.docker_config).where($[1] != null).select($[1]).reduce($1.mergeWith($2), {}) - data: - service_names: {get_param: [role_data, {{role.name}}, service_names]} - docker_config: {get_param: [role_data, {{role.name}}, docker_config]} - # BEGIN CONFIG STEPS {{role.name}}PreConfig: diff --git a/puppet/puppet-steps.j2 b/puppet/puppet-steps.j2 index 3d071018..37bc0002 100644 --- a/puppet/puppet-steps.j2 +++ b/puppet/puppet-steps.j2 @@ -36,7 +36,7 @@ resources: {{role.name}}Config: type: OS::TripleO::{{role.name}}Config properties: - StepConfig: {list_join: ["\n", {get_param: [role_data, {{role.name}}, step_config]}]} + StepConfig: {get_param: [role_data, {{role.name}}, step_config]} # Step through a series of configuration steps {% for step in range(1, deploy_steps_max) %} -- cgit 1.2.3-korg