LinchPin Hooks API¶
The linchpin.hooks module manages the hooks functionality within LinchPin.
ActionBlockRouter(name, *args, **kwargs)¶
Proxy pattern implementation for fetching actionmanagers by name
prepares few context parameters based on the current target_data that is being set. these parameters are based topology name.
run_actions(action_blocks, tgt_data, is_global=False)¶
Runs actions inside each action block of each target
- 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 ?’
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)