Merge "utils/config: generate param_config.json if param_config exists"

This commit is contained in:
Zuul 2019-06-11 10:04:26 +00:00 committed by Gerrit Code Review
commit 3fdc95b987
2 changed files with 10 additions and 0 deletions

View File

@ -70,6 +70,9 @@ class TestConfig(base.TestCase):
elif config == 'step_config':
expected_calls += [call('/tmp/tht/%s/%s.pp' %
(role, config))]
elif config == 'param_config':
expected_calls += [call('/tmp/tht/%s/%s.json' %
(role, config))]
else:
expected_calls += [call('/tmp/tht/%s/%s.yaml' %
(role, config))]
@ -608,6 +611,9 @@ class TestConfig(base.TestCase):
elif config == 'step_config':
expected_calls += [call('/tmp/tht/%s/%s.pp' %
(role, config))]
elif config == 'param_config':
expected_calls += [call('/tmp/tht/%s/%s.json' %
(role, config))]
else:
expected_calls += [call('/tmp/tht/%s/%s.yaml' %
(role, config))]

View File

@ -213,6 +213,10 @@ class Config(object):
filepath = os.path.join(role_path, 'step_config.pp')
with self._open_file(filepath) as step_config:
step_config.write(role[config])
elif config == 'param_config':
filepath = os.path.join(role_path, 'param_config.json')
with self._open_file(filepath) as param_config:
param_config.write(json.dumps(role[config]))
elif config == 'ansible_group_vars':
# NOTE(aschultz): ansible group vars are for specific role
# services so we merge them in with the others so they