From 8d549d0694d37d5ec9ebfde0de3e1182e44429cd Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Tue, 21 May 2013 23:06:11 +0100 Subject: [PATCH] engine : Fix ResourceFailure exception issues 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 | 4 ++-- heat/engine/resource.py | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/heat/engine/parser.py b/heat/engine/parser.py index 624d7f78..7dcccf3e 100644 --- a/heat/engine/parser.py +++ b/heat/engine/parser.py @@ -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 diff --git a/heat/engine/resource.py b/heat/engine/resource.py index fb5e93ca..0a93cd4e 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -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)) -- 2.45.2