class HooksMaster(object):
Undocumented
Static Method |
|
Undocumented |
Method | __init__ |
Base class for hooks masters. |
Method |
|
Run the special configuration update hook |
Method |
|
Run all the scripts for a phase. |
Instance Variable | build |
Undocumented |
Instance Variable | cluster |
Undocumented |
Instance Variable | hooks |
Undocumented |
Instance Variable | hooks |
Undocumented |
Instance Variable | hooks |
Undocumented |
Instance Variable | htype |
Undocumented |
Instance Variable | log |
Undocumented |
Instance Variable | master |
Undocumented |
Instance Variable | opcode |
Undocumented |
Instance Variable | post |
Undocumented |
Instance Variable | pre |
Undocumented |
Instance Variable | pre |
Undocumented |
Instance Variable | prepare |
Undocumented |
Method | _ |
Compute the environment and the target nodes. |
Method | _ |
Simple wrapper over self.callfn. |
Base class for hooks masters.
This class invokes the execution of hooks according to the behaviour specified by its parameters.
Parameters | |
opcode:string | opcode of the operation to which the hooks are tied |
hooks | prefix of the hooks directories |
nodes:2-tuple of lists | 2-tuple of lists containing nodes on which pre-hooks must be run and nodes on which post-hooks must be run |
hooks | function that will execute the hooks; can be None, indicating that no conversion is necessary. |
hooks | function that will adapt the return value of hooks_execution_fn to the format expected by RunPhase |
build | function that builds the environment for the hooks |
prepare | function that is invoked right before executing post hooks and can change the list of node UUIDs to run the post hooks on |
log | logging function |
htype:string or None | None or one of constants.HTYPE_CLUSTER , constants.HTYPE_NODE , constants.HTYPE_INSTANCE |
cluster | name of the cluster |
master | name of the master |
Run the special configuration update hook
This is a special hook that runs only on the master after each top-level LI if the configuration has been updated.
Run all the scripts for a phase.
This is the main function of the HookMaster. It executes self.hooks_execution_fn, and after running self.hooks_results_adapt_fn on its results it expects them to be in the form {node_name: (fail_msg, [(script, result, output), ...]}).
Parameters | |
phase | one of constants.HOOKS_PHASE_POST or constants.HOOKS_PHASE_PRE ; it denotes the hooks phase |
node | overrides the predefined list of nodes for the given phase |
Returns | |
the processed results of the hooks multi-node rpc call | |
Raises | |
errors.HooksFailure | on communication failure to the nodes |
errors.HooksAbort | on failure of one of the hooks |
Compute the environment and the target nodes.
Based on the opcode and the current node list, this builds the environment for the hooks and the target node list for the run.