diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 03a3065b9..e1174dfa6 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -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) diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py index 746293135..7185c575d 100644 --- a/heat/tests/test_resource.py +++ b/heat/tests/test_resource.py @@ -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') diff --git a/heat_integrationtests/functional/test_autoscaling.py b/heat_integrationtests/functional/test_autoscaling.py index cbb0fec23..c1d6d3058 100644 --- a/heat_integrationtests/functional/test_autoscaling.py +++ b/heat_integrationtests/functional/test_autoscaling.py @@ -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.