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

Module CedarBackup2.actions.validate

Implements the standard 'validate' action.

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

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

Variable Summary
Logger logger = <logging.Logger instance at 0x4032a74c>

Function Details

executeValidate(configPath, options, config)

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 - Path to configuration file on disk.
           (type=String representing a path on disk.)
options - Program command-line options.
           (type=Options object.)
config - Program configuration.
           (type=Config object.)
Raises:
ValueError - If some configuration value is invalid.

_checkDir(path, writable, logfunc, prefix)

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.

_validateCollect(config, logfunc)

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.

_validateExtensions(config, logfunc)

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.

_validateOptions(config, logfunc)

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.

_validatePurge(config, logfunc)

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.

_validateReference(config, logfunc)

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.

_validateStage(config, logfunc)

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)

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.

Variable Details

logger

Type:
Logger
Value:
<logging.Logger instance at 0x4032a74c>                                

Generated by Epydoc 2.1 on Thu Mar 29 20:58:27 2007 http://epydoc.sf.net