Browse Source

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
changes/85/533185/5
Steven Hardy 4 years ago
parent
commit
41988eab39
  1. 6
      common/deploy-steps-tasks.yaml
  2. 12
      common/deploy-steps.j2

6
common/deploy-steps-tasks.yaml

@ -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

12
common/deploy-steps.j2

@ -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

Loading…
Cancel
Save