Browse Source

Merge ansible_group_vars in THT

This removes merging of ansible_group_vars when
downloading config, as we now merge them from the
ServiceChains in THT in order to better manage them
at one place.

ExtraGroupVars override what's set in the services.

Depends-On: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/796135
Change-Id: I092a6bfb64d434e51b6434eb8216e0fd8dfb2187
changes/72/796172/1
ramishra 1 month ago
parent
commit
1fa0990327
  1. 16
      tripleo_common/tests/utils/test_config.py
  2. 4
      tripleo_common/utils/config.py

16
tripleo_common/tests/utils/test_config.py

@ -331,19 +331,13 @@ class TestConfig(base.TestCase):
'uuid': 2},
'overcloud-novacompute-2': {
'uuid': 3}}}},
{'output_key': 'RoleData',
'output_value': {
'Controller': {
'ansible_group_vars': {
'chrony_host': 'localhost',
'chrony_acl': 'none',
}}}},
{'output_key': 'RoleGroupVars',
'output_value': {
'Controller': {
'any_errors_fatal': True,
'chrony_host': '192.168.2.1',
'chrony_foo': 'bar',
'chrony_acl': 'none',
'max_fail_percentage': 15},
'Compute': {
'any_errors_fatal': True,
@ -745,19 +739,13 @@ class TestConfig(base.TestCase):
'a7db3010-a51f-4ae0-a791-2364d629d20d',
'8b07cd31-3083-4b88-a433-955f72039e2c',
'169b46f8-1965-4d90-a7de-f36fb4a830fe']}}},
{'output_key': 'RoleData',
'output_value': {
'Controller': {
'ansible_group_vars': {
'chrony_host': 'localhost',
'chrony_acl': 'none',
}}}},
{'output_key': 'RoleGroupVars',
'output_value': {
'Controller': {
'any_errors_fatal': True,
'chrony_host': '192.168.2.1',
'chrony_foo': 'bar',
'chrony_acl': 'none',
'max_fail_percentage': 15},
'Compute': {
'any_errors_fatal': True,

4
tripleo_common/utils/config.py

@ -261,10 +261,6 @@ class Config(object):
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':
role_config = role[config].copy()
role_config.update(role_group_vars[role_name])
role_group_vars[role_name] = role_config
else:
# NOTE(emilien): Move this condition to the
# upper level once THT is adapted for all tasks to be

Loading…
Cancel
Save