Default empty map for docker_config steps

In the event a step has no services defined, we must still write the
config, as this is needed if services are disabled on update such that
a step becomes empty - we must run paunch on every step or the cleanup
of the "old" services does not happen.

Closes-Bug: 1742915
Change-Id: Iee01002f56b5311560557f2bf6f053601b9d43d7
This commit is contained in:
Steven Hardy 2018-01-12 13:17:08 +00:00
parent 33a254cacb
commit 41988eab39
2 changed files with 10 additions and 8 deletions

View File

@ -50,11 +50,6 @@
##################################################
# Per step starting of the containers using paunch
##################################################
- name: Check if /var/lib/hashed-tripleo-config/docker-container-startup-config-step_{{step}}.json exists
stat:
path: /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
register: docker_config_json
become: true
# Note docker-puppet.py generates the hashed-*.json file, which is a copy of
# the *step_n.json with a hash of the generated external config added
# This acts as a salt to enable restarting the container if config changes
@ -63,7 +58,6 @@
paunch --debug apply
--file /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
--config-id tripleo_step{{step}} --managed-by tripleo-{{role_name}}
when: docker_config_json.stat.exists
changed_when: false
check_mode: no
register: outputs

View File

@ -239,6 +239,7 @@ resources:
bootstrap_server_id: {get_attr: [BootstrapServerId, value]}
puppet_step_config: {get_param: [role_data, {{role.name}}, step_config]}
docker_config_scripts: {get_param: [role_data, {{role.name}}, docker_config_scripts]}
deploy_steps_max: {{deploy_steps_max}}
tasks:
# Join host_prep_tasks with the other per-host configuration
list_concat:
@ -271,11 +272,18 @@ resources:
# and docker-cmd. This lets us create command line tools to test containers.
# FIXME do we need the docker-container-startup-configs.json or is the new per-step
# data consumed by paunch enough?
- name: Set docker_startup_configs_default fact
set_fact:
docker_startup_configs_default: "{{ '{{' }}docker_startup_configs_default|default({}) | combine( {'step_'+item: {}} ) {{ '}}'}}"
with_sequence: count="{{ '{{' }}deploy_steps_max{{ '}}' }}"
- name: Set docker_startup_configs_with_default fact
set_fact:
docker_startup_configs_with_default: "{{ '{{' }} docker_startup_configs_default | combine(docker_startup_configs) {{ '}}'}}"
- name: Write docker-container-startup-configs
copy: content="{{ '{{' }}docker_startup_configs | to_json{{ '}}' }}" dest=/var/lib/docker-container-startup-configs.json force=yes mode=0600
copy: content="{{ '{{' }} docker_startup_configs_with_default | to_json{{ '}}' }}" dest=/var/lib/docker-container-startup-configs.json force=yes mode=0600
- name: Write per-step docker-container-startup-configs
copy: content="{{ '{{' }}item.value|to_json{{ '}}' }}" dest="/var/lib/tripleo-config/docker-container-startup-config-{{ '{{' }}item.key{{ '}}' }}.json" force=yes mode=0600
with_dict: "{{ '{{' }}docker_startup_configs{{ '}}' }}"
with_dict: "{{ '{{' }} docker_startup_configs_with_default {{ '}}' }}"
- name: Create /var/lib/kolla/config_files directory
file: path=/var/lib/kolla/config_files state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true
- name: Write kolla config json files