Browse Source

Merge "Generate a play per step for external_deploy_tasks" into stable/train

changes/40/744140/1
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
033d9da8b6
4 changed files with 23 additions and 3 deletions
  1. +3
    -1
      tripleo_common/constants.py
  2. +4
    -1
      tripleo_common/tests/fake_config/fakes.py
  3. +6
    -1
      tripleo_common/tests/utils/test_config.py
  4. +10
    -0
      tripleo_common/utils/config.py

+ 3
- 1
tripleo_common/constants.py View File

@@ -203,7 +203,9 @@ TRIPLEO_NETWORK_CONFIG_RESOURCE = 'NetworkConfig'

HOST_NETWORK = 'ctlplane'

EXTERNAL_TASKS = ['external_deploy_tasks']
# The key is different in RoleConfig than in RoleData, so we need both so they
# are correctly found.
EXTERNAL_TASKS = ['external_deploy_tasks', 'external_deploy_steps_tasks']

ANSIBLE_ERRORS_FILE = 'ansible-errors.json'



+ 4
- 1
tripleo_common/tests/fake_config/fakes.py View File

@@ -29,7 +29,10 @@ FAKE_STACK = {
'outputs': [
{'output_key': 'RoleConfig',
'output_value': {
'foo_config': 'foo'}},
'foo_config': 'foo',
'external_deploy_steps_tasks': [{'name': 'Fake external task',
'debug': 'name=hello',
'when': 'step|int == 1'}]}},
{'output_key': 'HostnameNetworkConfigMap',
'output_value': {}},
{'output_key': 'RoleData',


+ 6
- 1
tripleo_common/tests/utils/test_config.py View File

@@ -50,7 +50,7 @@ class TestConfig(base.TestCase):
'service_metadata_settings',
'service_names',
'upgrade_batch_tasks', 'upgrade_tasks',
'external_deploy_tasks']
'external_deploy_steps_tasks']

heat = mock.MagicMock()
heat.stacks.get.return_value = fakes.create_tht_stack()
@@ -65,6 +65,11 @@ class TestConfig(base.TestCase):
mock_mkdir.assert_called()
expected_calls = []
for config in config_type_list:
if 'external' in config:
for step in range(constants.DEFAULT_STEPS_MAX):
expected_calls += [call('/tmp/tht/%s_step%s.yaml' %
(config, step))]

for role in fake_role:
if 'external' in config:
continue


+ 10
- 0
tripleo_common/utils/config.py View File

@@ -279,6 +279,16 @@ class Config(object):

role_config = self.get_role_config()
for config_name, config in six.iteritems(role_config):

# External tasks are in RoleConfig and not defined per role.
# So we don't use the RoleData to create the per step playbooks.
if config_name in constants.EXTERNAL_TASKS:
for i in range(constants.DEFAULT_STEPS_MAX):
filepath = os.path.join(config_dir,
'%s_step%s.yaml'
% (config_name, i))
self._write_tasks_per_step(config, filepath, i)

conf_path = os.path.join(config_dir, config_name)
# Add .yaml extension only if there's no extension already
if '.' not in conf_path:


Loading…
Cancel
Save