From 071b270cbe0b5cf0a42b744b68e1a5e3c35e59be Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 18 Oct 2019 09:47:22 -0400 Subject: [PATCH] paunch: only read container config JSON which starts by "hashed-" The container-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) We want to filter files starting by hashed- otherwise paunch will start the other containers which will clash with the hashed ones. Also make sure the container name doesn't have the "hashed-" prefix. Change-Id: If0f1c6c308cd58f7baa9a8449fbf685ff10f0e0a (cherry picked from commit 840e3c0e65abcb1a68aba6ae4ae9b60761410e72) --- tripleo_ansible/ansible_plugins/modules/paunch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tripleo_ansible/ansible_plugins/modules/paunch.py b/tripleo_ansible/ansible_plugins/modules/paunch.py index 6d1e5d16f..5594ee522 100644 --- a/tripleo_ansible/ansible_plugins/modules/paunch.py +++ b/tripleo_ansible/ansible_plugins/modules/paunch.py @@ -23,6 +23,7 @@ from ansible.module_utils.basic import AnsibleModule import json import os import paunch as p +import re import yaml from paunch import runner as prunner from paunch.builder import compose1 as pcompose1 @@ -153,10 +154,11 @@ class PaunchManager: container_configs = {} config_files = [c_json for c_json in os.listdir(self.config) - if c_json.endswith('.json')] + if c_json.startswith('hashed-') + and c_json.endswith('.json')] for cf in config_files: with open(os.path.join(self.config, cf), 'r') as f: - c = os.path.splitext(cf)[0] + c = re.sub('^hashed-', '', os.path.splitext(cf)[0]) container_configs[c] = {} container_configs[c].update(yaml.safe_load(f)) self.config_yaml = container_configs