From 78a5bc0554f7571bce9794618e3c653c109a90b1 Mon Sep 17 00:00:00 2001 From: Lee Yarwood Date: Fri, 17 Nov 2017 10:48:48 +0000 Subject: [PATCH] config: Always add step conditional first for upgrade_tasks This is required to ensure conditionals using variables set by prior steps are not evaluated prior to these steps running. Closes-bug: #1732888 Change-Id: I9f6d60f22ef4c057a0d5f47ac2bd4f08520faeec --- tripleo_common/tests/utils/test_config.py | 8 ++++---- tripleo_common/utils/config.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tripleo_common/tests/utils/test_config.py b/tripleo_common/tests/utils/test_config.py index b0cb7bf1c..e805bdac6 100644 --- a/tripleo_common/tests/utils/test_config.py +++ b/tripleo_common/tests/utils/test_config.py @@ -130,16 +130,16 @@ class TestConfig(base.TestCase): 'service': 'name=fake state=stopped', 'tags': 'step1', - 'when': ['existingcondition', - 'step|int == 1']}, + 'when': ['step|int == 1', + 'existingcondition']}, {'name': 'Stop nova-' 'compute service', 'service': 'name=openstack-nova-' 'compute state=stopped', 'tags': 'step1', - 'when': ['existing', - 'list', 'step|int == 1']}]} + 'when': ['step|int == 1', + 'existing', 'list']}]} mock_get_role_data.return_value = fake_role for role in fake_role: diff --git a/tripleo_common/utils/config.py b/tripleo_common/utils/config.py index 81c5e8ca2..8ab0e4410 100644 --- a/tripleo_common/utils/config.py +++ b/tripleo_common/utils/config.py @@ -140,7 +140,7 @@ class Config(object): # Skip to the next task, # there is an existing 'step|int == N' continue - whenexpr.append("step|int == %s" % step) + whenexpr.insert(0, "step|int == %s" % step) task['when'] = whenexpr def _write_playbook_get_tasks(self, tasks, role, filepath):