Home | Trees | Indices | Help |
|
---|
|
object --+ | Config
Class representing a Cedar Backup XML configuration document.
The Config
class is a Python object representation of a
Cedar Backup XML configuration file. It is intended to be the only
Python-language interface to Cedar Backup configuration on disk for both
Cedar Backup itself and for external applications.
The object representation is two-way: XML data can be used to create a
Config
object, and then changes to the object can be
propogated back to disk. A Config
object can even be used
to create a configuration file from scratch programmatically.
This class and the classes it is composed from often use Python's
property
construct to validate input and limit access to
values. Some validations can only be done once a document is considered
"complete" (see module notes for more details).
Assignments to the various instance variables must match the expected
type, i.e. reference
must be a ReferenceConfig
.
The internal check uses the built-in isinstance
function, so
it should be OK to use subclasses if you want to.
If an instance variable is not set, its value will be
None
. When an object is initialized without using an XML
document, all of the values will be None
. Even when an
object is initialized using XML, some of the values might be
None
because not every section is required.
Note: Lists within this class are "unordered" for equality comparisons.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
reference Reference configuration in terms of a ReferenceConfig
object.
|
|||
extensions Extensions configuration in terms of a ExtensionsConfig
object.
|
|||
options Options configuration in terms of a OptionsConfig
object.
|
|||
collect Collect configuration in terms of a CollectConfig
object.
|
|||
stage Stage configuration in terms of a StageConfig object.
|
|||
store Store configuration in terms of a StoreConfig object.
|
|||
purge Purge configuration in terms of a PurgeConfig object.
|
|||
peers Peers configuration in terms of a PeersConfig object.
|
|||
Inherited from |
|
Initializes a configuration object. If you initialize the object without passing either
No reference to the original XML data or original path is saved off by this class. Once the data has been parsed (successfully or not) this original information is discarded. Unless the
Note:
It is strongly suggested that the |
Official string representation for class instance.
|
Informal string representation for class instance.
|
Definition of equals operator for this class. Lists within this class are "unordered" for equality comparisons.
|
Extracts configuration into an XML document. If Unless the
Note:
It is strongly suggested that the |
Validates configuration represented by the object. This method encapsulates all of the validations that should apply to a fully "complete" document but are not already taken care of by earlier validations. It also provides some extra convenience functionality which might be useful to some people. The process of validation is laid out in the Validation section in the class notes (above).
|
Property target used to set the reference configuration value. If not
|
Property target used to set the extensions configuration value. If not
|
Property target used to set the options configuration value. If not
|
Property target used to set the peers configuration value. If not
|
Property target used to set the collect configuration value. If not
|
Property target used to set the stage configuration value. If not
|
Property target used to set the store configuration value. If not
|
Property target used to set the purge configuration value. If not
|
Internal method to parse an XML string into the object. This method parses the XML document into a DOM tree
( Most of the validation we do here has to do with whether the document can be parsed and whether any values which exist are valid. We don't do much validation as to whether required elements actually exist unless we have to to make sense of the document (instead, that's the job of the validate method).
|
Parses a reference configuration section. We read the following fields: author //cb_config/reference/author revision //cb_config/reference/revision description //cb_config/reference/description generator //cb_config/reference/generator
|
Parses an extensions configuration section. We read the following fields: orderMode //cb_config/extensions/order_mode We also read groups of the following items, one list element per item: name //cb_config/extensions/action/name module //cb_config/extensions/action/module function //cb_config/extensions/action/function index //cb_config/extensions/action/index dependencies //cb_config/extensions/action/depends The extended actions are parsed by _parseExtendedActions.
|
Parses a options configuration section. We read the following fields: startingDay //cb_config/options/starting_day workingDir //cb_config/options/working_dir backupUser //cb_config/options/backup_user backupGroup //cb_config/options/backup_group rcpCommand //cb_config/options/rcp_command rshCommand //cb_config/options/rsh_command cbackCommand //cb_config/options/cback_command managedActions //cb_config/options/managed_actions The list of managed actions is a comma-separated list of action names. We also read groups of the following items, one list element per item: overrides //cb_config/options/override hooks //cb_config/options/hook The overrides are parsed by _parseOverrides and the hooks are parsed by _parseHooks.
|
Parses a peers configuration section. We read groups of the following items, one list element per item: localPeers //cb_config/stage/peer remotePeers //cb_config/stage/peer The individual peer entries are parsed by _parsePeerList.
|
Parses a collect configuration section. We read the following individual fields: targetDir //cb_config/collect/collect_dir collectMode //cb_config/collect/collect_mode archiveMode //cb_config/collect/archive_mode ignoreFile //cb_config/collect/ignore_file We also read groups of the following items, one list element per item: absoluteExcludePaths //cb_config/collect/exclude/abs_path excludePatterns //cb_config/collect/exclude/pattern collectFiles //cb_config/collect/file collectDirs //cb_config/collect/dir The exclusions are parsed by _parseExclusions, the collect files are parsed by _parseCollectFiles, and the directories are parsed by _parseCollectDirs.
|
Parses a stage configuration section. We read the following individual fields: targetDir //cb_config/stage/staging_dir We also read groups of the following items, one list element per item: localPeers //cb_config/stage/peer remotePeers //cb_config/stage/peer The individual peer entries are parsed by _parsePeerList.
|
Parses a store configuration section. We read the following fields: sourceDir //cb_config/store/source_dir mediaType //cb_config/store/media_type deviceType //cb_config/store/device_type devicePath //cb_config/store/target_device deviceScsiId //cb_config/store/target_scsi_id driveSpeed //cb_config/store/drive_speed checkData //cb_config/store/check_data checkMedia //cb_config/store/check_media warnMidnite //cb_config/store/warn_midnite noEject //cb_config/store/no_eject Blanking behavior configuration is parsed by the
|
Parses a purge configuration section. We read groups of the following items, one list element per item: purgeDirs //cb_config/purge/dir The individual directory entries are parsed by _parsePurgeDirs.
|
Reads extended actions data from immediately beneath the parent. We read the following individual fields from each extended action: name name module module function function index index dependencies depends Dependency information is parsed by the
|
Reads exclusions data from immediately beneath the parent. We read groups of the following items, one list element per item: absolute exclude/abs_path relative exclude/rel_path patterns exclude/pattern If there are none of some pattern (i.e. no relative path items) then
This method can be used to parse exclusions on both the collect configuration level and on the collect directory level within collect configuration.
|
Reads a list of We read the following individual fields: command command absolutePath abs_path
|
Reads a list of We read the following individual fields: action action command command
|
Reads a list of We read the following individual fields: absolutePath abs_path collectMode mode I{or} collect_mode archiveMode archive_mode The collect mode is a special case. Just a
|
Reads a list of We read the following individual fields: absolutePath abs_path collectMode mode I{or} collect_mode archiveMode archive_mode ignoreFile ignore_file linkDepth link_depth dereference dereference recursionLevel recursion_level The collect mode is a special case. Just a We also read groups of the following items, one list element per item: absoluteExcludePaths exclude/abs_path relativeExcludePaths exclude/rel_path excludePatterns exclude/pattern The exclusions are parsed by _parseExclusions.
|
Reads a list of We read the following individual fields: absolutePath <baseExpr>/abs_path retainDays <baseExpr>/retain_days
|
Reads remote and local peer data from immediately beneath the parent. We read the following individual fields for both remote and local peers: name name collectDir collect_dir We also read the following individual fields for remote peers only: remoteUser backup_user rcpCommand rcp_command rshCommand rsh_command cbackCommand cback_command managed managed managedActions managed_actions Additionally, the value in the If there are none of one type of peer (i.e. no local peers) then
|
Reads extended action dependency information from a parent node. We read the following individual fields: runBefore depends/run_before runAfter depends/run_after Each of these fields is a comma-separated list of action names. The result is placed into an If the dependencies parent node does not exist,
|
Reads a single We read the following individual fields: blankMode blank_behavior/mode blankFactor blank_behavior/factor
|
Internal method to extract configuration into an XML string. This method assumes that the internal validate method has been called prior to extracting the XML, if the caller cares. No validation will be done internally. As a general rule, fields that are set to |
Adds a <reference> configuration section as the next child of a parent. We add the following fields to the document: author //cb_config/reference/author revision //cb_config/reference/revision description //cb_config/reference/description generator //cb_config/reference/generator If
|
Adds an <extensions> configuration section as the next child of a parent. We add the following fields to the document: order_mode //cb_config/extensions/order_mode We also add groups of the following items, one list element per item: actions //cb_config/extensions/action The extended action entries are added by _addExtendedAction. If
|
Adds a <options> configuration section as the next child of a parent. We add the following fields to the document: startingDay //cb_config/options/starting_day workingDir //cb_config/options/working_dir backupUser //cb_config/options/backup_user backupGroup //cb_config/options/backup_group rcpCommand //cb_config/options/rcp_command rshCommand //cb_config/options/rsh_command cbackCommand //cb_config/options/cback_command managedActions //cb_config/options/managed_actions We also add groups of the following items, one list element per item: overrides //cb_config/options/override hooks //cb_config/options/pre_action_hook hooks //cb_config/options/post_action_hook The individual override items are added by _addOverride. The individual hook items are added by _addHook. If
|
Adds a <peers> configuration section as the next child of a parent. We add groups of the following items, one list element per item: localPeers //cb_config/peers/peer remotePeers //cb_config/peers/peer The individual local and remote peer entries are added by _addLocalPeer and _addRemotePeer, respectively. If
|
Adds a <collect> configuration section as the next child of a parent. We add the following fields to the document: targetDir //cb_config/collect/collect_dir collectMode //cb_config/collect/collect_mode archiveMode //cb_config/collect/archive_mode ignoreFile //cb_config/collect/ignore_file We also add groups of the following items, one list element per item: absoluteExcludePaths //cb_config/collect/exclude/abs_path excludePatterns //cb_config/collect/exclude/pattern collectFiles //cb_config/collect/file collectDirs //cb_config/collect/dir The individual collect files are added by _addCollectFile and individual collect directories are added by _addCollectDir. If
|
Adds a <stage> configuration section as the next child of a parent. We add the following fields to the document: targetDir //cb_config/stage/staging_dir We also add groups of the following items, one list element per item: localPeers //cb_config/stage/peer remotePeers //cb_config/stage/peer The individual local and remote peer entries are added by _addLocalPeer and _addRemotePeer, respectively. If
|
Adds a <store> configuration section as the next child of a parent. We add the following fields to the document: sourceDir //cb_config/store/source_dir mediaType //cb_config/store/media_type deviceType //cb_config/store/device_type devicePath //cb_config/store/target_device deviceScsiId //cb_config/store/target_scsi_id driveSpeed //cb_config/store/drive_speed checkData //cb_config/store/check_data checkMedia //cb_config/store/check_media warnMidnite //cb_config/store/warn_midnite noEject //cb_config/store/no_eject refreshMediaDelay //cb_config/store/refresh_media_delay ejectDelay //cb_config/store/eject_delay Blanking behavior configuration is added by the _addBlankBehavior method. If
|
Adds a <purge> configuration section as the next child of a parent. We add the following fields to the document: purgeDirs //cb_config/purge/dir The individual directory entries are added by _addPurgeDir. If
|
Adds an extended action container as the next child of a parent. We add the following fields to the document: name action/name module action/module function action/function index action/index dependencies action/depends Dependencies are added by the _addDependencies method. The <action> node itself is created as the next child of the
parent node. This method only adds one action node. The parent must loop
for each action in the If
|
Adds a command override container as the next child of a parent. We add the following fields to the document: command override/command absolutePath override/abs_path The <override> node itself is created as the next child of the
parent node. This method only adds one override node. The parent must
loop for each override in the If
|
Adds an action hook container as the next child of a parent. The behavior varies depending on the value of the action pre_action_hook/action command pre_action_hook/command If the action post_action_hook/action command post_action_hook/command The <pre_action_hook> or <post_action_hook> node itself is
created as the next child of the parent node. This method only adds one
hook node. The parent must loop for each hook in the
If
|
Adds a collect file container as the next child of a parent. We add the following fields to the document: absolutePath dir/abs_path collectMode dir/collect_mode archiveMode dir/archive_mode Note that for consistency with collect directory handling we'll only
emit the preferred The <file> node itself is created as the next child of the
parent node. This method only adds one collect file node. The parent
must loop for each collect file in the If
|
Adds a collect directory container as the next child of a parent. We add the following fields to the document: absolutePath dir/abs_path collectMode dir/collect_mode archiveMode dir/archive_mode ignoreFile dir/ignore_file linkDepth dir/link_depth dereference dir/dereference recursionLevel dir/recursion_level Note that an original XML document might have listed the collect mode
using the We also add groups of the following items, one list element per item: absoluteExcludePaths dir/exclude/abs_path relativeExcludePaths dir/exclude/rel_path excludePatterns dir/exclude/pattern The <dir> node itself is created as the next child of the parent
node. This method only adds one collect directory node. The parent must
loop for each collect directory in the If
|
Adds a local peer container as the next child of a parent. We add the following fields to the document: name peer/name collectDir peer/collect_dir ignoreFailureMode peer/ignore_failures Additionally, The <peer> node itself is created as the next child of the
parent node. This method only adds one peer node. The parent must loop
for each peer in the If
|
Adds a remote peer container as the next child of a parent. We add the following fields to the document: name peer/name collectDir peer/collect_dir remoteUser peer/backup_user rcpCommand peer/rcp_command rcpCommand peer/rcp_command rshCommand peer/rsh_command cbackCommand peer/cback_command ignoreFailureMode peer/ignore_failures managed peer/managed managedActions peer/managed_actions Additionally, The <peer> node itself is created as the next child of the
parent node. This method only adds one peer node. The parent must loop
for each peer in the If
|
Adds a purge directory container as the next child of a parent. We add the following fields to the document: absolutePath dir/abs_path retainDays dir/retain_days The <dir> node itself is created as the next child of the parent
node. This method only adds one purge directory node. The parent must
loop for each purge directory in the If
|
Adds a extended action dependencies to parent node. We add the following fields to the document: runBefore depends/run_before runAfter depends/run_after If
|
Creates a comma-separated string from a list of values. As a special case, if
|
Adds a blanking behavior container as the next child of a parent. We add the following fields to the document: blankMode blank_behavior/mode blankFactor blank_behavior/factor The <blank_behavior> node itself is created as the next child of the parent node. If
|
Validates configuration contents per rules discussed in module documentation. This is the second pass at validation. It ensures that any filled-in
section contains valid data. Any sections which is not set to
|
Validates reference configuration. There are currently no reference-related validations.
|
Validates extensions configuration. The list of actions may be either Then, if the order mode is None or "index", an index is required; and if the order mode is "dependency", dependency information is required.
|
Validates options configuration. All fields must be filled in except the rsh command. The rcp and rsh commands are used as default values for all remote peers. Remote peers can also rely on the backup user as the default remote user name if they choose.
|
Validates peers configuration per rules in _validatePeerList.
|
Validates collect configuration. The target directory must be filled in. The collect mode, archive
mode, ignore file, and recursion level are all optional. The list of
absolute paths to exclude and patterns to exclude may be either
Each collect directory entry must contain an absolute path to collect,
and then must either be able to take collect mode, archive mode and
ignore file configuration from the parent
|
Validates stage configuration. The target directory must be filled in, and the peers are also validated. Peers are only required in this section if the peers configuration section is not filled in. However, if any peers are filled in here, they override the peers configuration and must meet the validation criteria in _validatePeerList.
|
Validates store configuration. The device type, drive speed, and blanking behavior are optional. All other values are required. Missing booleans will be set to defaults. If blanking behavior is provided, then both a blanking mode and a blanking factor are required. The image writer functionality in the Any caller which needs a "real" (non- This is also where we make sure that the media type -- which is already a valid type -- matches up properly with the device type.
|
Validates purge configuration. The list of purge directories may be either
|
Validates the set of local and remote peers. Local peers must be completely filled in, including both name and collect directory. Remote peers must also fill in the name and collect directory, but can leave the remote user and rcp command unset. In this case, the remote user is assumed to match the backup user from the options section and rcp command is taken directly from the options section.
|
|
referenceReference configuration in terms of a
|
extensionsExtensions configuration in terms of a
|
optionsOptions configuration in terms of a
|
collectCollect configuration in terms of a
|
stageStage configuration in terms of a |
storeStore configuration in terms of a |
purgePurge configuration in terms of a |
peersPeers configuration in terms of a |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jul 29 18:03:34 2015 | http://epydoc.sourceforge.net |