Fix regression in validation action
Regression with https://review.opendev.org/#/c/656379/
self.stack is dict rather than a python object from action
heat.stacks_get and is an input to this action.
Change-Id: I92c9d0bb5ddac5b8a887a3acf3fc3314aab5867b
Closes-Bug: #1834054
Related-Bug: #1826925
(cherry picked from commit 19148898aa
)
This commit is contained in:
parent
f9801ec9bd
commit
eca1924ec3
|
@ -438,7 +438,7 @@ class CheckNodesCountAction(base.TripleOAction):
|
|||
requested_count = 0
|
||||
|
||||
for param, default in self.default_role_counts.items():
|
||||
if self.stack and self.stack.status != 'FAILED':
|
||||
if self.stack and 'FAILED' not in self.stack['stack_status']:
|
||||
try:
|
||||
current = int(self.stack['parameters'][param])
|
||||
except KeyError:
|
||||
|
|
|
@ -816,9 +816,8 @@ class TestCheckNodesCountAction(base.TestCase):
|
|||
def test_check_nodes_count_scale_enough_nodes(self):
|
||||
action_args = self.action_args.copy()
|
||||
action_args['parameters'] = {'ControllerCount': 2}
|
||||
params = self.defaults.copy()
|
||||
self.stack = mock.Mock(status='COMPLETE',
|
||||
parameters=params)
|
||||
action_args['stack'] = {'parameters': self.defaults.copy(),
|
||||
'stack_status': 'CREATE_COMPLETE'}
|
||||
|
||||
action = validations.CheckNodesCountAction(**action_args)
|
||||
result = action.run(self.ctx)
|
||||
|
@ -839,9 +838,8 @@ class TestCheckNodesCountAction(base.TestCase):
|
|||
def test_check_nodes_count_scale_too_much(self):
|
||||
action_args = self.action_args.copy()
|
||||
action_args['parameters'] = {'ControllerCount': 3}
|
||||
params = self.defaults.copy()
|
||||
self.stack = mock.Mock(status='COMPLETE',
|
||||
parameters=params)
|
||||
action_args['stack'] = {'parameters': self.defaults.copy(),
|
||||
'stack_status': 'CREATE_COMPLETE'}
|
||||
|
||||
action = validations.CheckNodesCountAction(**action_args)
|
||||
result = action.run(self.ctx)
|
||||
|
@ -866,8 +864,8 @@ class TestCheckNodesCountAction(base.TestCase):
|
|||
action_args['parameters'] = {'ControllerCount': 3}
|
||||
params = self.defaults.copy()
|
||||
del params[missing_param]
|
||||
self.stack = mock.Mock(status='COMPLETE',
|
||||
parameters=params)
|
||||
action_args['stack'] = {'parameters': self.defaults.copy(),
|
||||
'stack_status': 'CREATE_COMPLETE'}
|
||||
action = validations.CheckNodesCountAction(**action_args)
|
||||
result = action.run(self.ctx)
|
||||
|
||||
|
|
Loading…
Reference in New Issue