From dcf2463f1f21ed6b011730eceb6977d1582c912f Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Fri, 7 Jul 2017 18:44:13 -0400 Subject: [PATCH] Fix ResourceActionNotSupported errors in log In 37ef66970510972af54ce6835ec234f3e30a0a88 (in Kilo) we made signalling a resource asynchronous because things like e.g. scaling an autoscaling group were too slow to do synchronously (bug 1394095). However, for resources that don't have a handle_signal() method at all, this means that if a signal other than one handled by Heat (e.g. to clear a hook) is received then the user won't be notified of the error. There will instead be an error message in the logs warning of an unhandled exception in a thread. (Previously, similar problems occurred if the user was attempting to clear a hook and some error occurred. This has since been fixed as bug 1472515, in Liberty.) If there's no handle_signal() method defined, then calling Resource.signal() is quick (i.e. it's only going to clear a hook, or raise an error). So handle this case synchronously. This ensures that any error is reported to the user and not in the log. Change-Id: I917b4c7d4ab2cde46148197a3a232d5dc70f63d7 Related-Bug: #1472515 --- heat/engine/service.py | 5 +++-- heat_integrationtests/api/gabbits/resources.yaml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/heat/engine/service.py b/heat/engine/service.py index 31b6874da6..ed7ee65c64 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -1872,12 +1872,13 @@ class EngineService(service.ServiceBase): if callable(rsrc.signal): rsrc._signal_check_action() rsrc._signal_check_hook(details) - if sync_call: + if sync_call or not callable(getattr(rsrc, 'handle_signal', None)): _resource_signal(stack, rsrc, details, False) - return rsrc.metadata_get() else: self.thread_group_mgr.start(stack.id, _resource_signal, stack, rsrc, details, False) + if sync_call: + return rsrc.metadata_get() @context.request_context def resource_mark_unhealthy(self, cnxt, stack_identity, resource_name, diff --git a/heat_integrationtests/api/gabbits/resources.yaml b/heat_integrationtests/api/gabbits/resources.yaml index 164f4cb3e0..41da4448de 100644 --- a/heat_integrationtests/api/gabbits/resources.yaml +++ b/heat_integrationtests/api/gabbits/resources.yaml @@ -82,7 +82,7 @@ tests: - name: signal resource POST: $LAST_URL/signal - status: 200 + status: 400 - name: delete stack with resources DELETE: /stacks/$ENVIRON['PREFIX']-rsrcstack