]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Fail fast if Resource action methods are missing
authorZane Bitter <zbitter@redhat.com>
Mon, 12 Aug 2013 09:12:33 +0000 (11:12 +0200)
committerZane Bitter <zbitter@redhat.com>
Mon, 12 Aug 2013 09:12:33 +0000 (11:12 +0200)
If a resource is not actually a Resource with create(), delete() &c.
methods then something has gone horribly, horribly wrong. This is not a
priority for handling gracefully at runtime.

Change-Id: Iafce8e4a222677fc590bb579654e195dc4252a9e

heat/engine/parser.py

index 8d29dfe4f2f2e1a6984043d0deb486f49e195293..5cebd4dce9db97557f5e56c096005fdff348489f 100644 (file)
@@ -333,13 +333,9 @@ class Stack(object):
         def resource_action(r):
             # Find e.g resource.create and call it
             action_l = action.lower()
-            handle = getattr(r, '%s' % action_l, None)
-            if callable(handle):
-                return handle()
-            else:
-                raise exception.ResourceFailure(
-                    AttributeError(_('Resource action %s not found') %
-                                   action_l), r)
+            handle = getattr(r, '%s' % action_l)
+
+            return handle()
 
         action_task = scheduler.DependencyTaskGroup(self.dependencies,
                                                     resource_action,