Package ganeti :: Module backend :: Class HooksRunner
[hide private]
[frames] | no frames]

Class HooksRunner

source code


Hook runner.

This class is instantiated on the node side (ganeti-noded) and not on the master side.

Instance Methods [hide private]
 
__init__(self, hooks_base_dir=None)
Constructor for hooks runner.
source code
 
RunLocalHooks(self, node_list, hpath, phase, env)
Check that the hooks will be run only locally and then run them.
source code
list
RunHooks(self, hpath, phase, env)
Run the scripts in the hooks directory.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, hooks_base_dir=None)
(Constructor)

source code 

Constructor for hooks runner.

Parameters:
Overrides: object.__init__

RunHooks(self, hpath, phase, env)

source code 

Run the scripts in the hooks directory.

Parameters:
  • hpath (str) - the path to the hooks directory which holds the scripts
  • phase (str) - either constants.HOOKS_PHASE_PRE or constants.HOOKS_PHASE_POST
  • env (dict) - dictionary with the environment for the hook
Returns: list
list of 3-element tuples:
  • script path
  • script result, either constants.HKR_SUCCESS or constants.HKR_FAIL
  • output of the script
Raises: