From: Steven Hardy Date: Tue, 19 Feb 2013 18:17:02 +0000 (+0000) Subject: heat engine : avoid returning empty resource error strings X-Git-Tag: 2014.1~883^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2f4b981cd4a373cb66af935558e2ed3a779dd202;p=openstack-build%2Fheat-build.git heat engine : avoid returning empty resource error strings Avoid the possibility of returning an empty string (when Exceptions have not got a string message), or parser.py will treat the error as success and the resource operation failure will not be correctly reflected in the resource state. fixes bug 1130270 Change-Id: I1c55dea1f9615cd4b037802ff8c1066694bffea6 --- diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 98b6ea74..68cb8ef0 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -297,7 +297,7 @@ class Resource(object): else: logger.exception('create %s', str(self)) self.state_set(self.CREATE_FAILED, str(ex)) - return str(ex) + return str(ex) or "Error : %s" % type(ex) else: self.state_set(self.CREATE_COMPLETE) @@ -329,7 +329,7 @@ class Resource(object): except Exception as ex: logger.exception('update %s : %s' % (str(self), str(ex))) self.state_set(self.UPDATE_FAILED, str(ex)) - return str(ex) + return str(ex) or "Error : %s" % type(ex) else: # If resource was updated (with or without interruption), # then we set the resource to UPDATE_COMPLETE @@ -372,7 +372,7 @@ class Resource(object): except Exception as ex: logger.exception('Delete %s', str(self)) self.state_set(self.DELETE_FAILED, str(ex)) - return str(ex) + return str(ex) or "Error : %s" % type(ex) self.state_set(self.DELETE_COMPLETE) @@ -395,7 +395,7 @@ class Resource(object): pass except Exception as ex: logger.exception('Delete %s from DB' % str(self)) - return str(ex) + return str(ex) or "Error : %s" % type(ex) self.id = None