Browse Source

Merge "config: refactor how per step tasks are generated" into stable/stein

changes/50/706650/1
Zuul 1 week ago
parent
commit
c99ed78db0
3 changed files with 12 additions and 7 deletions
  1. +3
    -1
      tripleo_common/constants.py
  2. +1
    -1
      tripleo_common/tests/utils/test_config.py
  3. +8
    -5
      tripleo_common/utils/config.py

+ 3
- 1
tripleo_common/constants.py View File

@@ -211,4 +211,6 @@ MISTRAL_WORK_DIR = '/var/lib/mistral'

EXCLUSIVE_NEUTRON_DRIVERS = ['ovn', 'openvswitch']

UPGRADE_STEPS_MAX = 6
DEFAULT_STEPS_MAX = 6

PER_STEP_TASKS = ['upgrade_tasks']

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

@@ -163,7 +163,7 @@ class TestConfig(base.TestCase):
for role in fake_role:
filedir = os.path.join(self.tmp_dir, role)
os.makedirs(filedir)
for step in range(constants.UPGRADE_STEPS_MAX):
for step in range(constants.DEFAULT_STEPS_MAX):
filepath = os.path.join(filedir, "upgrade_tasks_step%s.yaml"
% step)
playbook_tasks = self.config._write_tasks_per_step(

+ 8
- 5
tripleo_common/utils/config.py View File

@@ -223,15 +223,18 @@ class Config(object):
role_group_vars[role_name] = {}
role_group_vars[role_name].update(role[config])
else:
# NOTE(jfrancoa): Move this upgrade_tasks condition to the
# upper level once THT is adapted. We include it here to
# allow the CI to pass until THT changed is not merged.
if config == 'upgrade_tasks':
for i in range(constants.UPGRADE_STEPS_MAX):
# NOTE(emilien): Move this condition to the
# upper level once THT is adapted for all tasks to be
# run per step.
# We include it here to allow the CI to pass until THT
# changed is not merged.
if config in constants.PER_STEP_TASKS:
for i in range(constants.DEFAULT_STEPS_MAX):
filepath = os.path.join(role_path, '%s_step%s.yaml'
% (config, i))
self._write_tasks_per_step(role[config], role_name,
filepath, i)

try:
data = role[config]
except KeyError as e:

Loading…
Cancel
Save