]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat engine : only attempt stack update from valid states
authorSteven Hardy <shardy@redhat.com>
Wed, 10 Oct 2012 17:51:20 +0000 (18:51 +0100)
committerSteven Hardy <shardy@redhat.com>
Wed, 10 Oct 2012 18:04:17 +0000 (19:04 +0100)
Only attempt to update a stack if it is in CREATE_COMPLETE
or UPDATE_COMPLETE state

Fixes #260

Change-Id: If47a628f1602d5d8783b3f0e90fd7e76ccef46ba
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/engine/parser.py

index b3142d6a73901899fa93082de1d51a15c15c4399..e61922308a3f2ce1dbe72f968b48040d3baca4e4 100644 (file)
@@ -459,7 +459,11 @@ class Stack(object):
         Update will fail if it exceeds the specified timeout. The default is
         60 minutes, set in the constructor
         '''
-        self.state_set(self.UPDATE_IN_PROGRESS, 'Stack update started')
+        if self.state not in (self.CREATE_COMPLETE, self.UPDATE_COMPLETE):
+            self.state_set(self.UPDATE_FAILED, 'State invalid for update')
+            return
+        else:
+            self.state_set(self.UPDATE_IN_PROGRESS, 'Stack update started')
 
         # Now make the resources match the new stack definition
         failures = []