CedarBackup2.actions.stage

Package CedarBackup2 :: Package actions :: Module stage |
[hide private]
[frames] | no frames]

# Module stage

source code

Implements the standard 'stage' action.

Author: Kenneth J. Pronovici <pronovic@ieee.org>

Functions | [hide private]
executeStage(configPath, options, config) Executes the stage backup action. | source code
_createStagingDirs(config, dailyDir, peers) Creates staging directories as required. | source code
_getIgnoreFailuresFlag(options, config, peer) Gets the ignore failures flag based on options, configuration, and peer. | source code
_getDailyDir(config) Gets the daily staging directory. | source code
_getLocalPeers(config) Return a list of LocalPeer objects based on configuration. | source code
_getRemotePeers(config) Return a list of RemotePeer objects based on configuration. | source code
_getRemoteUser(config, remotePeer) Gets the remote user associated with a remote peer. | source code
_getLocalUser(config) Gets the remote user associated with a remote peer. | source code
_getRcpCommand(config, remotePeer) Gets the RCP command associated with a remote peer. | source code

Variables | [hide private]
| logger = `logging.getLogger("CedarBackup2.log.actions.stage")`
| __package__ = ``'``CedarBackup2.actions``'``

Function Details | [hide private]

### executeStage(configPath, options, config) | source code
Executes the stage backup action. Parameters: `configPath` (String representing a path on disk.) - Path to configuration file on disk. `options` (Options object.) - Program command-line options. `config` (Config object.) - Program configuration. Raises: `ValueError` - Under many generic error conditions `IOError` - If there are problems reading or writing files. Notes: The daily directory is derived once and then we stick with it, just in case a backup happens to span midnite. As portions of the stage action is complete, we will write various indicator files so that it's obvious what actions have been completed. Each peer gets a stage indicator in its collect directory, and then the master gets a stage indicator in its daily staging directory. The store process uses the master's stage indicator to decide whether a directory is ready to be stored. Currently, nothing uses the indicator at each peer, and it exists for reference only.

### _createStagingDirs(config, dailyDir, peers) | source code
Creates staging directories as required. The main staging directory is the passed in daily directory, something like `staging/2002/05/23`. Then, individual peers get their own directories, i.e. `staging/2002/05/23/host`. Parameters: `config` - Config object. `dailyDir` - Daily staging directory. `peers` - List of all configured peers. Returns: Dictionary mapping peer name to staging directory.

### _getIgnoreFailuresFlag(options, config, peer) | source code
Gets the ignore failures flag based on options, configuration, and peer. Parameters: `options` - Options object `config` - Configuration object `peer` - Peer to check Returns: Whether to ignore stage failures for this peer

### _getDailyDir(config) | source code
Gets the daily staging directory. This is just a directory in the form `staging/YYYY/MM/DD`, i.e. `staging/2000/10/07`, except it will be an absolute path based on `config.stage.targetDir`. Parameters: `config` - Config object Returns: Path of daily staging directory.

### _getLocalPeers(config) | source code
Return a list of LocalPeer objects based on configuration. Parameters: `config` - Config object. Returns: List of LocalPeer objects.

### _getRemotePeers(config) | source code
Return a list of RemotePeer objects based on configuration. Parameters: `config` - Config object. Returns: List of RemotePeer objects.

### _getRemoteUser(config, remotePeer) | source code
Gets the remote user associated with a remote peer. Use peer's if possible, otherwise take from options section. Parameters: `config` - Config object. `remotePeer` - Configuration-style remote peer object. Returns: Name of remote user associated with remote peer.

### _getLocalUser(config) | source code
Gets the remote user associated with a remote peer. Parameters: `config` - Config object. Returns: Name of local user that should be used

### _getRcpCommand(config, remotePeer) | source code
Gets the RCP command associated with a remote peer. Use peer's if possible, otherwise take from options section. Parameters: `config` - Config object. `remotePeer` - Configuration-style remote peer object. Returns: RCP command associated with remote peer.