]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
engine : remove unnecessary default check_*_complete functions
authorSteven Hardy <shardy@redhat.com>
Fri, 28 Jun 2013 09:22:29 +0000 (10:22 +0100)
committerSteven Hardy <shardy@redhat.com>
Fri, 28 Jun 2013 16:26:45 +0000 (17:26 +0100)
The default behavior in _do_action is to declare COMPLETE if the
check_$action_complete is not implemented, so these default
functions returning True are not needed.

Change-Id: I2fd1b7da1d39d23abc81e1b9171b053e547b2ec6

heat/engine/resource.py

index 9bb6689059da7dca9a131c41afa0af4e8839436c..725319f04ba493e40278a76d97095c26c6707227 100644 (file)
@@ -335,6 +335,12 @@ class Resource(object):
         corresponding handle_* and check_*_complete functions
         Note pre_func is an optional function reference which will
         be called before the handle_<action> function
+
+        If the resource does not declare a check_$action_complete function,
+        we declare COMPLETE status as soon as the handle_$action call has
+        finished, and if no handle_$action function is declared, then we do
+        nothing, useful e.g if the resource requires no action for a given
+        state transition
         '''
         assert action in self.ACTIONS, 'Invalid action %s' % action
 
@@ -390,26 +396,6 @@ class Resource(object):
                                      self.name)
         return self._do_action(self.CREATE, self.properties.validate)
 
-    def check_create_complete(self, create_data):
-        '''
-        Check if the resource is active (ready to move to the CREATE_COMPLETE
-        state). By default this happens as soon as the handle_create() method
-        has completed successfully, but subclasses may customise this by
-        overriding this function. The return value of handle_create() is
-        passed in to this function each time it is called.
-        '''
-        return True
-
-    def check_suspend_complete(self, suspend_data):
-        '''
-        Check if the resource is suspended
-        By default this happens as soon as the handle_suspend() method
-        has completed successfully, but subclasses may customise this by
-        overriding this function. The return value of handle_suspend() is
-        passed in to this function each time it is called.
-        '''
-        return True
-
     def update(self, json_snippet=None):
         '''
         update the resource. Subclasses should provide a handle_update() method