An action plan contains actions for execution.
The action plan is built by executing a phase function. Each phase function calls actions which insert themselves into the action plan.
The action plan is transformed to provide aggregated operations, and to resolve precedence relations between actions.
A translated plan is executed by passing an executor, which is a map from action type to function. The executor functions are called with the result of evaluating the action with it's arguments.
Extract an action's dependencies. Actions are id'd with keywords, and dependencies are declared on an action's id or function.
Given a map of dependencies, each with an :f and maybe a :action-id, returns a map where the values are all matching action instances
Return an action map for the given args. The action plan is a tree of action maps.
precedence specifies naming and dependencies, with :action-id, :always-before and :always-after. If a precedence is supplied, an action-id is generated if none present, to ensure that the standard action precedence is not altered.
- :f the action function
- :args the arguments to pass to the action function
- :location where to execute the action - :orgin or :target
- :action-type the type of action - :script/bash, :fn/clojure, etc
- :execution the execution type - :in-sequence, :aggregated, :collected
- :value the result of calling the action function, :f, with :args
- :session the session map after calling the action function.
Add an action to the plan
Change the return type of an action, to be an action map with :value and :session keys that are the value of the action, and the updated session map for the next action. This creates a consistent return value for all action types (effectively creating a monadic value which is a map).
Bind an action's arguments.
Create the action plan by calling the current phase for the target group.
Extract an action's id to function mapping
Combine actions by action-type
Execute actions by passing the un-evaluated actions to the
function (a function with an arglist of [session f action-type location]).
Execute a single action
Execute the translated action plan for the current target.
Get the action plan for the current phase and target node.
Return the phase for the target
Take the last block and add it to the scope below it in the stack. The block is reversed to put it into the order in which elements were added. Once pop'd, nothing should be added to the block.
Push a block onto the action-plan
Reset the action plan for the current phase and target.
Return the script template for the current group node.
Return the script template for the specified server.
Return the vector path of the action plan for the current session target node, or target group.
Traverses an action-plan structure. Converting nested scopes into action-map's.
Process the action-plan, applying groupings and precedence, producing an action plan with fully bound functions, ready for execution.
This is equivalent to using an identity monad with a monadic value that is a tree of action maps.
Build the action plan and translate for the current phase and target node.
Predicate to test if an action plan has been translated