Merge "Create an event when signalling fails"
This commit is contained in:
commit
b59bf5836b
@ -1108,8 +1108,8 @@ class Resource(object):
|
||||
handler is implemented.
|
||||
'''
|
||||
if self.action in (self.SUSPEND, self.DELETE):
|
||||
LOG.exception(_LE('Cannot signal resource '
|
||||
'during %s'), self.action)
|
||||
self._add_event(self.action, self.status,
|
||||
'Cannot signal resource during %s' % self.action)
|
||||
ex = Exception(_('Cannot signal resource during %s') % self.action)
|
||||
raise exception.ResourceFailure(ex, self)
|
||||
|
||||
|
@ -131,10 +131,14 @@ class ResourceTest(common.HeatTestCase):
|
||||
for action in actions:
|
||||
for status in res.STATUSES:
|
||||
res.state_set(action, status)
|
||||
ev = self.patchobject(res, '_add_event')
|
||||
ex = self.assertRaises(exception.ResourceFailure,
|
||||
res.signal)
|
||||
self.assertEqual('Exception: Cannot signal resource during '
|
||||
'%s' % action, six.text_type(ex))
|
||||
ev.assert_called_with(
|
||||
action, status,
|
||||
'Cannot signal resource during %s' % action)
|
||||
|
||||
def test_resource_str_repr_stack_id_resource_id(self):
|
||||
tmpl = rsrc_defn.ResourceDefinition('test_res_str_repr', 'Foo')
|
||||
|
@ -742,6 +742,12 @@ outputs:
|
||||
|
||||
# Send a signal and confirm nothing happened.
|
||||
self.client.resources.signal(stack_identifier, 'ScaleUpPolicy')
|
||||
ev = self.wait_for_event_with_reason(
|
||||
stack_identifier,
|
||||
reason='Cannot signal resource during SUSPEND',
|
||||
rsrc_name='ScaleUpPolicy')
|
||||
self.assertEqual('SUSPEND_COMPLETE', ev[0].resource_status)
|
||||
|
||||
# still SUSPEND_COMPLETE (not gone to UPDATE_COMPLETE)
|
||||
self._wait_for_stack_status(nested_ident, 'SUSPEND_COMPLETE')
|
||||
# still 2 instances.
|
||||
|
Loading…
Reference in New Issue
Block a user