Fix exception when create bay failed

Fix Wrong usage of bay object when create bay failed, stack_status should be
should from stack.

Closes-Bug: #1509236
Change-Id: Ieea0c990853d49876f4bbf850c8f6aaa6cef9683
This commit is contained in:
Eli Qiao 2015-10-23 16:10:57 +08:00
parent 373d73d1f7
commit 38c9cb1ab7
2 changed files with 4 additions and 4 deletions

View File

@ -240,7 +240,7 @@ class HeatPoller(object):
if stack.stack_status in (bay_status.CREATE_FAILED,
bay_status.DELETE_FAILED,
bay_status.UPDATE_FAILED):
self._bay_failed()
self._bay_failed(stack)
raise loopingcall.LoopingCallDone()
# only check max attempts when the stack is being created when
# the timeout hasn't been set. If the timeout has been set then
@ -291,10 +291,10 @@ class HeatPoller(object):
self.bay.node_count = stack.parameters[stack_nc_param]
self.bay.save()
def _bay_failed(self):
def _bay_failed(self, stack):
LOG.error(_LE('Bay error, stack status: %(bay_status)s, '
'stack_id: %(stack_id)s, '
'reason: %(reason)s') %
{'bay_status': self.bay.stack_status,
{'bay_status': stack.stack_status,
'stack_id': self.bay.stack_id,
'reason': self.bay.status_reason})

View File

@ -376,5 +376,5 @@ class TestHeatPoller(base.TestCase):
@patch('magnum.conductor.handlers.bay_conductor.LOG')
def test_bay_failed(self, logger):
mock_heat_stack, bay, poller = self.setup_poll_test()
poller._bay_failed()
poller._bay_failed(mock_heat_stack)
self.assertEqual(1, logger.error.call_count)