CedarBackup2.actions.validate

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

# Module validate

source code

Implements the standard 'validate' action.

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

Functions | [hide private]
executeValidate(configPath, options, config) Executes the validate action. | source code
_checkDir(path, writable, logfunc, prefix) Checks that the indicated directory is OK. | source code
_validateReference(config, logfunc) Execute runtime validations on reference configuration. | source code
_validateOptions(config, logfunc) Execute runtime validations on options configuration. | source code
_validateCollect(config, logfunc) Execute runtime validations on collect configuration. | source code
_validateStage(config, logfunc) Execute runtime validations on stage configuration. | source code
_validateStore(config, logfunc) Execute runtime validations on store configuration. | source code
_validatePurge(config, logfunc) Execute runtime validations on purge configuration. | source code
_validateExtensions(config, logfunc) Execute runtime validations on extensions configuration. | source code

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

Function Details | [hide private]

### executeValidate(configPath, options, config) | source code
Executes the validate action. This action validates each of the individual sections in the config file. This is a "runtime" validation. The config file itself is already valid in a structural sense, so what we check here that is that we can actually use the configuration without any problems. There's a separate validation function for each of the configuration sections. Each validation function returns a true/false indication for whether configuration was valid, and then logs any configuration problems it finds. This way, one pass over configuration indicates most or all of the obvious problems, rather than finding just one problem at a time. Any reported problems will be logged at the ERROR level normally, or at the INFO level if the quiet flag is enabled. 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` - If some configuration value is invalid.

### _checkDir(path, writable, logfunc, prefix) | source code
Checks that the indicated directory is OK. The path must exist, must be a directory, must be readable and executable, and must optionally be writable. Parameters: `path` - Path to check. `writable` - Check that path is writable. `logfunc` - Function to use for logging errors. `prefix` - Prefix to use on logged errors. Returns: True if the directory is OK, False otherwise.

### _validateReference(config, logfunc) | source code
Execute runtime validations on reference configuration. We only validate that reference configuration exists at all. Parameters: `config` - Program configuration. `logfunc` - Function to use for logging errors Returns: True if configuration is valid, false otherwise.

### _validateOptions(config, logfunc) | source code
Execute runtime validations on options configuration. The following validations are enforced: The options section must exist The working directory must exist and must be writable The backup user and backup group must exist Parameters: `config` - Program configuration. `logfunc` - Function to use for logging errors Returns: True if configuration is valid, false otherwise.

### _validateCollect(config, logfunc) | source code
Execute runtime validations on collect configuration. The following validations are enforced: The target directory must exist and must be writable Each of the individual collect directories must exist and must be readable Parameters: `config` - Program configuration. `logfunc` - Function to use for logging errors Returns: True if configuration is valid, false otherwise.

### _validateStage(config, logfunc) | source code
Execute runtime validations on stage configuration. The following validations are enforced: The target directory must exist and must be writable Each local peer's collect directory must exist and must be readable Parameters: `config` - Program configuration. `logfunc` - Function to use for logging errors Returns: True if configuration is valid, False otherwise. Note: We currently do not validate anything having to do with remote peers, since we don't have a straightforward way of doing it. It would require adding an rsh command rather than just an rcp command to configuration, and that just doesn't seem worth it right now.

### _validateStore(config, logfunc) | source code
Execute runtime validations on store configuration. The following validations are enforced: The source directory must exist and must be readable The backup device (path and SCSI device) must be valid Parameters: `config` - Program configuration. `logfunc` - Function to use for logging errors Returns: True if configuration is valid, False otherwise.

### _validatePurge(config, logfunc) | source code
Execute runtime validations on purge configuration. The following validations are enforced: Each purge directory must exist and must be writable Parameters: `config` - Program configuration. `logfunc` - Function to use for logging errors Returns: True if configuration is valid, False otherwise.

### _validateExtensions(config, logfunc) | source code
Execute runtime validations on extensions configuration. The following validations are enforced: Each indicated extension function must exist. Parameters: `config` - Program configuration. `logfunc` - Function to use for logging errors Returns: True if configuration is valid, False otherwise.