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
(cherry picked from commit 78a5bc0554)
This commit is contained in:
Lee Yarwood 2017-11-17 10:48:48 +00:00
parent a95aa5ad8f
commit 1b8af1e043
2 changed files with 5 additions and 5 deletions

View File

@ -120,16 +120,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:

View File

@ -67,7 +67,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
else:
task.update({"when": "step|int == %s" % step})