+ def __init__(self, opcode, hooks_path, nodes, hooks_execution_fn,
+ hooks_results_adapt_fn, build_env_fn, log_fn, htype=None, cluster_name=None,
+ master_name=None):
+ """Base class for hooks masters.
+
+ This class invokes the execution of hooks according to the behaviour
+ specified by its parameters.
+
+ @type opcode: string
+ @param opcode: opcode of the operation to which the hooks are tied
+ @type hooks_path: string
+ @param hooks_path: prefix of the hooks directories
+ @type nodes: 2-tuple of lists
+ @param nodes: 2-tuple of lists containing nodes on which pre-hooks must be
+ run and nodes on which post-hooks must be run
+ @type hooks_execution_fn: function that accepts the following parameters:
+ (node_list, hooks_path, phase, environment)
+ @param hooks_execution_fn: function that will execute the hooks; can be
+ None, indicating that no conversion is necessary.
+ @type hooks_results_adapt_fn: function
+ @param hooks_results_adapt_fn: function that will adapt the return value of
+ hooks_execution_fn to the format expected by RunPhase
+ @type build_env_fn: function that returns a dictionary having strings as
+ keys
+ @param build_env_fn: function that builds the environment for the hooks
+ @type log_fn: function that accepts a string
+ @param log_fn: logging function
+ @type htype: string or None
+ @param htype: None or one of L{constants.HTYPE_CLUSTER},
+ L{constants.HTYPE_NODE}, L{constants.HTYPE_INSTANCE}
+ @type cluster_name: string
+ @param cluster_name: name of the cluster
+ @type master_name: string
+ @param master_name: name of the master