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
This commit is contained in:
Steven Hardy 2013-02-19 18:17:02 +00:00
parent 54defea528
commit 2f4b981cd4
1 changed files with 4 additions and 4 deletions

View File

@ -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