]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
engine : simplify resource state check
authorSteven Hardy <shardy@redhat.com>
Fri, 28 Jun 2013 15:43:41 +0000 (16:43 +0100)
committerSteven Hardy <shardy@redhat.com>
Fri, 28 Jun 2013 16:27:04 +0000 (17:27 +0100)
Simplify the test to check the resource is in a COMPLETE state
(other than DELETE_COMPLETE), so we don't have to update this for
every new action state which gets added

Change-Id: I91286d3d0464b1a71dafd01ac209ea7ded259875

heat/engine/resource.py

index 725319f04ba493e40278a76d97095c26c6707227..8a6435c1297bb32a1a562650efd111360e3b8063 100644 (file)
@@ -444,9 +444,7 @@ class Resource(object):
         instances is a non-immediate operation and we want to paralellize
         '''
         # Don't try to suspend the resource unless it's in a stable state
-        if self.state not in ((self.CREATE, self.COMPLETE),
-                              (self.UPDATE, self.COMPLETE),
-                              (self.ROLLBACK, self.COMPLETE)):
+        if (self.action == self.DELETE or self.status != self.COMPLETE):
             exc = exception.Error('State %s invalid for suspend'
                                   % str(self.state))
             raise exception.ResourceFailure(exc)