Convert step to integer in when statement for upgrade tasks
Currently the when conditionals in the upgrade tasks aren't evaluated correctly and as a result the upgrade tasks are skipped. This change converts the step variable in the when statement to an integer to get it evaluated properly. Related-Bug: 1708115 Change-Id: I4ee1a2729d74442570f1b1f38b0d03a95ea7793f
This commit is contained in:
parent
4ae96dde41
commit
53f79082ca
|
@ -145,18 +145,18 @@ class TestOvercloudConfig(utils.TestCommand):
|
||||||
'service': 'name=fake '
|
'service': 'name=fake '
|
||||||
'state=stopped',
|
'state=stopped',
|
||||||
'tags': 'step1',
|
'tags': 'step1',
|
||||||
'when': 'step == 1'}],
|
'when': 'step|int == 1'}],
|
||||||
'FakeCompute': [{'name': 'Stop fake service',
|
'FakeCompute': [{'name': 'Stop fake service',
|
||||||
'service': 'name=fake state=stopped',
|
'service': 'name=fake state=stopped',
|
||||||
'tags': 'step1',
|
'tags': 'step1',
|
||||||
'when': 'step == 1'},
|
'when': 'step|int == 1'},
|
||||||
{'name': 'Stop nova-'
|
{'name': 'Stop nova-'
|
||||||
'compute service',
|
'compute service',
|
||||||
'service':
|
'service':
|
||||||
'name=openstack-nova-'
|
'name=openstack-nova-'
|
||||||
'compute state=stopped',
|
'compute state=stopped',
|
||||||
'tags': 'step1',
|
'tags': 'step1',
|
||||||
'when': 'step == 1'}]
|
'when': 'step|int == 1'}]
|
||||||
}
|
}
|
||||||
mock_get_role_data.return_value = fake_role
|
mock_get_role_data.return_value = fake_role
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,10 @@ class DownloadConfig(command.Command):
|
||||||
when_exists = re.search('step == [0-9]', whenline)
|
when_exists = re.search('step == [0-9]', whenline)
|
||||||
if when_exists: # skip if there is an existing 'step == N'
|
if when_exists: # skip if there is an existing 'step == N'
|
||||||
continue
|
continue
|
||||||
task['when'] = "(%s) and (step == %s)" % (whenline, step)
|
task['when'] = "(%s) and (step|int == %s)" % (whenline,
|
||||||
|
step)
|
||||||
else:
|
else:
|
||||||
task.update({"when": "step == %s" % step})
|
task.update({"when": "step|int == %s" % step})
|
||||||
|
|
||||||
def _write_playbook_get_tasks(self, tasks, role, filepath):
|
def _write_playbook_get_tasks(self, tasks, role, filepath):
|
||||||
playbook = []
|
playbook = []
|
||||||
|
|
Loading…
Reference in New Issue