]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat engine : avoid returning empty resource error strings
authorSteven Hardy <shardy@redhat.com>
Tue, 19 Feb 2013 18:17:02 +0000 (18:17 +0000)
committerSteven Hardy <shardy@redhat.com>
Tue, 19 Feb 2013 18:17:02 +0000 (18:17 +0000)
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

heat/engine/resource.py

index 98b6ea74461dae3f297e7e66085972cd885915ac..68cb8ef0602b802ca75c95967d0876affdbb1998 100644 (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