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
This commit is contained in:
parent
4cb02021ec
commit
840e3c0e65
|
@ -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
|
||||
|
@ -149,10 +150,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
|
||||
|
|
Loading…
Reference in New Issue