From 1755b9db53150f006e8d9c12983e0438875a3a8b Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Fri, 28 Jun 2013 10:22:29 +0100 Subject: [PATCH] engine : remove unnecessary default check_*_complete functions 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 | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 9bb66890..725319f0 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -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_ 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 -- 2.45.2