LinchPin Hooks API
The linchpin.hooks module manages the Linchpin Hooks functionality within LinchPin.
- class linchpin.hooks.ActionBlockRouter(name, *args, **kwargs)
Proxy pattern implementation for fetching actionmanagers by name
- class linchpin.hooks.LinchpinHooks(api)
- execute_hook(block_obj, target)
- fetch_git_src(block)
- fetch_src(block)
- get_custom_action_manager(action_block)
- global_hooks_block(block)
- prepare_ctx_params()
prepares few context parameters based on the current target_data that is being set. these parameters are based topology name.
- prepare_inv_params()
- resolve_block_path(block)
- run_action(state, block, tgt_data)
- run_actions(state, action_blocks, tgt_data, is_global=False)
Runs actions inside each action block of each target
- Parameters
action_blocks – list of action_blocks each block constitues to a type of hook
tgt_data – data specific to target, which can be dict of
topology , layout, outputs, inventory :param is_global: scope of the hook
example: action_block: - name: do_something
type: shell actions:
echo ‘ this is ‘postup’ operation Hello hai how r u ?’
- run_hooks(state, is_global=False)
Function to run hook all hooks from Pinfile based on the state :param state: hook state (currently, preup, postup, predestroy, postdestroy) :param is_global: whether the hook is global (can be applied to multiple targets)
- run_inventory_gen(data)
- run_local_actions(state, action_blocks, tgt_data)
- property rundb