utils/config: generate param_config.json if param_config exists
In https://review.opendev.org/#/c/661093, we are preparing a new interface "param_config" which exposes the parameters structure used by the configuration tools. To use this data, we want to write it on the host so it can be consummed later by the configuration management tools (e.g. Hiera or Ansible later?). The file will be generated next to step_config.pp and will mostly be useful when running Puppet on baremetal hosts for now: A new hieradata file will be created in https://review.opendev.org/#/c/661093 called param_config.json, which will be at the top level hierarchy. The "param_config" parameter will have a deep merge behavior so hiera data files like extraconfig, etc, will be able to override this configuration. When Puppet is run _from_ the containers, the container-puppet.py will read the same data directly from the puppet_config for each service (if it does exist). Change-Id: I8127203b82e503fb9d6013b47fdd3066aee1b474
This commit is contained in:
parent
6c4832a7ca
commit
12a415a8c7
@ -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))]
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user