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

Module rebuild

source code

Implements the standard 'rebuild' action.


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

Functions [hide private]
 
executeRebuild(configPath, options, config)
Executes the rebuild backup action.
source code
 
_findRebuildDirs(config)
Finds the set of directories to be included in a disc rebuild.
source code
Variables [hide private]
  logger = logging.getLogger("CedarBackup2.log.actions.rebuild")
Function Details [hide private]

executeRebuild(configPath, options, config)

source code 

Executes the rebuild backup action.

This function exists mainly to recreate a disc that has been "trashed" due to media or hardware problems. Note that the "stage complete" indicator isn't checked for this action.

Note that the rebuild action and the store action are very similar. The main difference is that while store only stores a single day's staging directory, the rebuild action operates on multiple staging directories.
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.

_findRebuildDirs(config)

source code 

Finds the set of directories to be included in a disc rebuild.

A the rebuild action is supposed to recreate the "last week's" disc. This won't always be possible if some of the staging directories are missing. However, the general procedure is to look back into the past no further than the previous "starting day of week", and then work forward from there trying to find all of the staging directories between then and now that still exist and have a stage indicator.
Parameters:
  • config - Config object.
Returns:
Correct staging dir, as a dict mapping directory to date suffix.
Raises:
  • IOError - If we do not find at least one staging directory.