Merge "paunch: only read container config JSON which starts by "hashed-"" into stable/train

This commit is contained in:
Zuul 2020-01-09 21:42:06 +00:00 committed by Gerrit Code Review
commit ee731ba16f
1 changed files with 4 additions and 2 deletions

View File

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