]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
engine : Fix ResourceFailure exception issues
authorSteven Hardy <shardy@redhat.com>
Tue, 21 May 2013 22:06:11 +0000 (23:06 +0100)
committerSteven Hardy <shardy@redhat.com>
Tue, 21 May 2013 22:06:11 +0000 (23:06 +0100)
Fix some issues spotted in https://review.openstack.org/#/c/29543
These errors were spotted after the patch was merged, the
ResourceFailure exception takes an Exception not string argument

Change-Id: I72045ecf147c66a0a1cf1ef5df7fb3be8100384d

heat/engine/parser.py
heat/engine/resource.py

index 624d7f7835b7f7d71272cf844d6d6b3f39df2927..7dcccf3effc0364280073745fc547029f7c9ce09 100644 (file)
@@ -406,8 +406,8 @@ class Stack(object):
                                 self.resources.itervalues())
                             scheduler.TaskRunner(res.create)()
                         else:
-                            raise exception.ResourceFailure(
-                                "Unexpected update retval %s" % retval)
+                            raise exception.ResourceFailure(ValueError(
+                                "Unexpected update retval %s" % retval))
 
                 if action == self.UPDATE:
                     stack_status = self.UPDATE_COMPLETE
index fb5e93ca11f78e0799fb1e05e172a8f190bfaa28..0a93cd4edbee2c06262dc8df41602cc64c085d97 100644 (file)
@@ -360,13 +360,11 @@ class Resource(object):
         update the resource. Subclasses should provide a handle_update() method
         to customise update, the base-class handle_update will fail by default.
         '''
-        if self.state in (self.CREATE_IN_PROGRESS, self.UPDATE_IN_PROGRESS):
-            raise exception.ResourceFailure(
-                'Resource update already requested')
+        assert json_snippet is not None, 'Must specify update json snippet'
 
-        if not json_snippet:
-            raise exception.ResourceFailure(
-                'Must specify json snippet for resource update!')
+        if self.state in (self.CREATE_IN_PROGRESS, self.UPDATE_IN_PROGRESS):
+            raise exception.ResourceFailure(Exception(
+                'Resource update already requested'))
 
         logger.info('updating %s' % str(self))