pallet.action documentation

Actions implement the conversion of phase functions to script and other execution code.

An action has an :action-type. Known types include :script/bash and :fn/clojure.

An action has a :location, with a value of :origin for execution on the node running pallet, and :target for the target node.

An action has an :execution, which is one of :aggregated, :in-sequence or :collected. Calls to :aggregated actions will be grouped, and run before :in-sequence actions. Calls to :collected actions will be grouped, and run after :in-sequence actions.

action

[execution action-type location [session & args] & body]

Define an anonymous action

action-fn

[action]

Retrieve the action-fn that is used to execute the specified action.

action-metadata

[session f]

Compute action metadata from precedence specification in session

aggregated-action

[[session & args] & body]

Define a remotely executed aggregated action function, which will be executed before :in-sequence actions.

as-clj-action

[f [session & args]]
[f]

An adaptor for using a normal function as a local action function

bash-action

[[session & args] & body]

Define a remotely executed bash action function.

clj-action

[[session & args] & body]

Define a clojure action to be executed on the origin machine.

collected-action

[[session & args] & body]

Define a remotely executed collected action function, which will be executed after :in-sequence actions.

def-action-def

[name actionfn1]

Define a macro for definining action defining vars

enter-scope

[session]

Enter a new action scope.

leave-scope

[session]

Leave the current action scope.

schedule-action

[session action-fn metadata args execution action-type location]

Registers an action in the action plan. The action is generated by the specified action function and arguments that will be applied to the function when the action plan is executed.

The action can be scheduled within one of three 'executions' (conceptually, sub-phases):

:in-sequence : The generated action will be applied to the node "in order", as it is defined lexically in the source crate. This is the default.

:aggregated : All aggregated actions are applied to the node in the order they are defined, but before all :in-sequence actions. Note that all of the arguments to any given action function are gathered such that there is only ever one invocation of each fn within each phase.

:collected : All collected actions are applied to the node in the order they are defined, but after all :in-sequence action. Note that all of the arguments to any given action function are gathered such that there is only ever one invocation of each fn within each phase.

The action-type determines how the action should be handled:

:script/bash : action produces bash script for execution on remote machine

:fn/clojure : action is a function for local execution

:transfer/to-local : action is a function specifying remote source and local destination.

:transfer/from-local : action is a function specifying local source and remote destination.

with-action-options

[request m & body]

Set up local precedence relations between actions

with-precedence

[request m & body]

Deprecated: 0.7.0

Set up local precedence relations between actions