Package CedarBackup2 :: Module cli :: Class _ManagedActionItem
[hide private]
[frames] | no frames]

Class _ManagedActionItem

source code

object --+
         |
        _ManagedActionItem

Class representing a single action to be executed on a managed peer.

This class represents a single named action to be executed, and understands how to execute that action.

Actions to be executed on a managed peer rely on peer configuration and on the full-backup flag. All other configuration takes place on the remote peer itself.


Note: The comparison operators for this class have been implemented to only compare based on the index and SORT_ORDER value, and ignore all other values. This is so that the action set list can be easily sorted first by type (_ActionItem before _ManagedActionItem) and then by index within type.

Instance Methods [hide private]
 
__init__(self, index, name, remotePeers)
Default constructor.
source code
 
__cmp__(self, other)
Definition of equals operator for this class.
source code
 
executeAction(self, configPath, options, config)
Executes the managed action associated with an item.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  SORT_ORDER = 1
Defines a sort order to order properly between types.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, index, name, remotePeers)
(Constructor)

source code 
Default constructor.
Parameters:
  • index - Index of the item (or None).
  • name - Name of the action that is being executed.
  • remotePeers - List of remote peers on which to execute the action.
Overrides: object.__init__

__cmp__(self, other)
(Comparison operator)

source code 
Definition of equals operator for this class. The only thing we compare is the item's index.
Parameters:
  • other - Other object to compare to.
Returns:
-1/0/1 depending on whether self is <, = or > other.

executeAction(self, configPath, options, config)

source code 
Executes the managed action associated with an item.
Parameters:
  • configPath - Path to configuration file on disk.
  • options - Command-line options to be passed to action.
  • config - Parsed configuration to be passed to action.
Raises:
  • Exception - If there is a problem executing the action.
Notes:
  • Only options.full is actually used. The rest of the arguments exist to satisfy the ActionItem iterface.
  • Errors here result in a message logged to ERROR, but no thrown exception. The analogy is the stage action where a problem with one host should not kill the entire backup. Since we're logging an error, the administrator will get an email.