Class _ActionSet
source code
object --+
         |
        _ActionSet
Class representing a set of local actions to be executed.
  This class does four different things.  First, it ensures that the 
  actions specified on the command-line are sensible.  The command-line can
  only list either built-in actions or extended actions specified in 
  configuration. Also, certain actions (in NONCOMBINE_ACTIONS) cannot be combined with other 
  actions.
  Second, the class enforces an execution order on the specified 
  actions.  Any time actions are combined on the command line (either 
  built-in actions or extended actions), we must make sure they get 
  executed in a sensible order.
  Third, the class ensures that any pre-action or post-action hooks are 
  scheduled and executed appropriately.  Hooks are configured by building a
  dictionary mapping between hook action name and command.  Pre-action 
  hooks are executed immediately before their associated action, and 
  post-action hooks are executed immediately after their associated 
  action.
  Finally, the class properly interleaves local and managed actions so 
  that the same action gets executed first locally and then on managed 
  peers.
    |  | 
        
          | __init__(self,
        actions,
        extensions,
        options,
        peers,
        managed,
        local) Constructor for the
 _ActionSetclass. | source code |  | 
    |  | 
        
          | executeActions(self,
        configPath,
        options,
        config) Executes all actions and extended actions, in the proper order.
 | source code |  | 
  
    | Inherited from object:__delattr__,__format__,__getattribute__,__hash__,__new__,__reduce__,__reduce_ex__,__repr__,__setattr__,__sizeof__,__str__,__subclasshook__ | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  | 
        
          | _buildActionMap(managed,
        local,
        extensionNames,
        functionMap,
        indexMap,
        preHookMap,
        postHookMap,
        peerMap) Builds a mapping from action name to list of action items.
 | source code |  | 
    |  |  | 
    |  | 
        
          | _deriveHooks(action,
        preHookDict,
        postHookDict) Derive pre- and post-action hooks, if any, associated with named 
      action.
 | source code |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
  
    | Inherited from object:__class__ | 
| 
  | __init__(self,
        actions,
        extensions,
        options,
        peers,
        managed,
        local)
    (Constructor)
 | source code |  Constructor for the _ActionSetclass. This is kind of ugly, because the constructor has to set up a lot of 
  data before being able to do anything useful.  The following data 
  structures are initialized based on the input: 
    
      extensionNames: List of extensions available in 
      configuration
      preHookMap: Mapping from action name to list ofPreActionHook
      postHookMap: Mapping from action name to list ofPostActionHook
      functionMap: Mapping from action name to Python function
      indexMap: Mapping from action name to execution index
      peerMap: Mapping from action name to set ofRemotePeer
      actionMap: Mapping from action name to_ActionItem Once these data structures are set up, the command line is validated 
  to make sure only valid actions have been requested, and in a sensible 
  combination.  Then, all of the data is used to build 
  self.actionSet, the set action items to be executed byexecuteActions().  This list might contain either_ActionItemor_ManagedActionItem. 
    Parameters:
        actions- Names of actions specified on the command-line.extensions- Extended action configuration (i.e. config.extensions)options- Options configuration (i.e. config.options)peers- Peers configuration (i.e. config.peers)managed- Whether to include managed actions in the setlocal- Whether to include local actions in the setRaises:
        ValueError- If one of the specified actions is invalid.Overrides:
        object.__init__
     | 
 
| 
  | executeActions(self,
        configPath,
        options,
        config)
   | source code |  Executes all actions and extended actions, in the proper order. Each action (whether built-in or extension) is executed in an 
  identical manner.  The built-in actions will use only the options and 
  config values.  We also pass in the config path so that extension modules
  can re-parse configuration if they want to, to add in extra 
  information. 
    Parameters:
        configPath- Path to configuration file on disk.options- Command-line options to be passed to action functions.config- Parsed configuration to be passed to action functions.Raises:
        Exception- If there is a problem executing the actions. | 
 
| 
  | _deriveExtensionNames(extensions)
    Static Method
 | source code |  Builds a list of extended actions that are available in 
  configuration. 
    Parameters:
        extensions- Extended action configuration (i.e. config.extensions)Returns:List of extended action names. | 
 
| Build two mappings from action name to configured 
  ActionHook. 
    Parameters:
        hooks- List of pre- and post-action hooks (i.e. config.options.hooks)Returns:Tuple of (pre hook dictionary, post hook dictionary). | 
 
| 
  | _buildFunctionMap(extensions)
    Static Method
 | source code |  Builds a mapping from named action to action function. 
    Parameters:
        extensions- Extended action configuration (i.e. config.extensions)Returns:Dictionary mapping action to function. | 
 
| Builds a mapping from action name to proper execution index. If extensions configuration is None, or there are no 
  configured extended actions, the ordering dictionary will only include 
  the built-in actions and their standard indices. Otherwise, if the extensions order mode is Noneor"index", actions will scheduled by explicit index;
  and if the extensions order mode is"dependency", 
  actions will be scheduled using a dependency graph. 
    Parameters:
        extensions- Extended action configuration (i.e. config.extensions)Returns:Dictionary mapping action name to integer execution index. | 
 
| 
  | _buildActionMap(managed,
        local,
        extensionNames,
        functionMap,
        indexMap,
        preHookMap,
        postHookMap,
        peerMap)
    Static Method
 | source code |  Builds a mapping from action name to list of action items. We build either _ActionItemor_ManagedActionItemobjects here. In most cases, the mapping from action name to 
  _ActionItemis 1:1. The exception is the "all" 
  action, which is a special case.  However, a list is returned in all 
  cases, just for consistency later.  Each_ActionItemwill be
  created with a proper function reference and index value for execution 
  ordering. The mapping from action name to _ManagedActionItemis 
  always 1:1. Each managed action item contains a list of peers which the 
  action should be executed. 
    Parameters:
        managed- Whether to include managed actions in the setlocal- Whether to include local actions in the setextensionNames- List of valid extended action namesfunctionMap- Dictionary mapping action name to Python functionindexMap- Dictionary mapping action name to integer execution indexpreHookMap- Dictionary mapping action name to pre hooks (if any) for the 
          actionpostHookMap- Dictionary mapping action name to post hooks (if any) for the 
          actionpeerMap- Dictionary mapping action name to list of remote peers on which 
          to execute the actionReturns:Dictionary mapping action name to list of 
          _ActionItemobjects. | 
 
| 
  | _buildPeerMap(options,
        peers)
    Static Method
 | source code |  Build a mapping from action name to list of remote peers. There will be one entry in the mapping for each managed action.  If 
  there are no managed peers, the mapping will be empty.  Only managed 
  actions will be listed in the mapping. 
    Parameters:
        options- Option configuration (i.e. config.options)peers- Peers configuration (i.e. config.peers) | 
 
| 
  | _deriveHooks(action,
        preHookDict,
        postHookDict)
    Static Method
 | source code |  Derive pre- and post-action hooks, if any, associated with named 
  action. 
    Parameters:
        action- Name of action to look uppreHookDict- Dictionary mapping pre-action hooks to action namepostHookDict- Dictionary mapping post-action hooks to action name @return Tuple
          (preHooks, postHooks) per mapping, with None values if there is 
          no hook. | 
 
| 
  | _validateActions(actions,
        extensionNames)
    Static Method
 | source code |  Validate that the set of specified actions is sensible. Any specified action must either be a built-in action or must be among
  the extended actions defined in configuration.  The actions from within 
  NONCOMBINE_ACTIONS may not be combined with other 
  actions. 
    Parameters:
        actions- Names of actions specified on the command-line.extensionNames- Names of extensions specified in configuration.Raises:
        ValueError- If one or more configured actions are not valid. | 
 
| 
  | _buildActionSet(actions,
        actionMap)
    Static Method
 | source code |  Build set of actions to be executed. The set of actions is built in the proper order, so 
  executeActionscan spin through the set without thinking 
  about it.  Since we've already validated that the set of actions is 
  sensible, we don't take any precautions here to make sure things are 
  combined properly.  If the action is listed, it will be 
  "scheduled" for execution. 
    Parameters:
        actions- Names of actions specified on the command-line.actionMap- Dictionary mapping action name to_ActionItemobject.Returns:Set of action items in proper order. | 
 
| 
  | _getRemoteUser(options,
        remotePeer)
    Static Method
 | source code |  Gets the remote user associated with a remote peer. Use peer's if 
  possible, otherwise take from options section. 
    Parameters:
        options- OptionsConfig object, as from config.optionsremotePeer- Configuration-style remote peer object.Returns:Name of remote user associated with remote peer. | 
 
| 
  | _getRshCommand(options,
        remotePeer)
    Static Method
 | source code |  Gets the RSH command associated with a remote peer. Use peer's if 
  possible, otherwise take from options section. 
    Parameters:
        options- OptionsConfig object, as from config.optionsremotePeer- Configuration-style remote peer object.Returns:RSH command associated with remote peer. | 
 
| 
  | _getCbackCommand(options,
        remotePeer)
    Static Method
 | source code |  Gets the cback command associated with a remote peer. Use peer's if 
  possible, otherwise take from options section. 
    Parameters:
        options- OptionsConfig object, as from config.optionsremotePeer- Configuration-style remote peer object.Returns:cback command associated with remote peer. | 
 
| 
  | _getManagedActions(options,
        remotePeer)
    Static Method
 | source code |  Gets the managed actions list associated with a remote peer. Use 
  peer's if possible, otherwise take from options section. 
    Parameters:
        options- OptionsConfig object, as from config.optionsremotePeer- Configuration-style remote peer object.Returns:Set of managed actions associated with remote peer. |