Home | Trees | Indices | Help |
|
---|
|
The functionality in this module encapsulates the command-line interface for the cback script. The cback script itself is very short, basically just an invokation of one function implemented here. That, in turn, makes it simpler to validate the command line interface (for instance, it's easier to run pychecker against a module, and unit tests are easier, too).
The objects and functions implemented in this module are probably not useful to any code external to Cedar Backup. Anyone else implementing their own command-line interface would have to reimplement (or at least enhance) all of this anyway.Author: Kenneth J. Pronovici <pronovic@ieee.org>
|
|||
Options Class representing command-line options for the cback script. |
|||
_ActionItem Class representing a single action to be executed. |
|||
_ManagedActionItem Class representing a single action to be executed on a managed peer. |
|||
_ActionSet Class representing a set of local actions to be executed. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
DEFAULT_CONFIG =
The default configuration file. |
|||
DEFAULT_LOGFILE =
The default log file path. |
|||
DEFAULT_OWNERSHIP =
Default ownership for the logfile. |
|||
DEFAULT_MODE = 416 Default file permissions mode on the logfile. |
|||
VALID_ACTIONS =
List of valid actions. |
|||
COMBINE_ACTIONS =
List of actions which can be combined with other actions. |
|||
NONCOMBINE_ACTIONS =
List of actions which cannot be combined with other actions. |
|||
logger = logging.getLogger("CedarBackup2.log.cli")
|
|||
DISK_LOG_FORMAT =
|
|||
DISK_OUTPUT_FORMAT =
|
|||
SCREEN_LOG_FORMAT =
|
|||
SCREEN_LOG_STREAM = <epydoc.docintrospecter._DevNull instance
|
|||
DATE_FORMAT =
|
|||
REBUILD_INDEX = 0
|
|||
VALIDATE_INDEX = 0
|
|||
INITIALIZE_INDEX = 0
|
|||
COLLECT_INDEX = 100
|
|||
STAGE_INDEX = 200
|
|||
STORE_INDEX = 300
|
|||
PURGE_INDEX = 400
|
|||
SHORT_SWITCHES =
|
|||
LONG_SWITCHES =
|
|
Implements the command-line interface for the Essentially, this is the "main routine" for the cback script. It does all of the argument processing for the script, and then sets about executing the indicated actions. As a general rule, only the actions indicated on the command line will be executed. We will accept any of the built-in actions and any of the configured extended actions (which makes action list verification a two- step process). The Raised exceptions always result in an immediate return. Otherwise, we generally return when all specified actions have been completed. Actions are ignored if the help, version or validate flags are set. A different error code is returned for each type of failure:
Notes:
|
Note:
The |
Note:
The |
Note:
The |
Set up logging based on command-line options. There are two kinds of logging: flow logging and output logging.
Output logging contains information about system commands executed by
Cedar Backup, for instance the calls to By default, output logging is disabled. When the
options.quiet flag is set, flow logging is enabled at the
INFO level to the configured logfile only (i.e. no output will be sent to
the screen). If the options.verbose flag is set, flow
logging is enabled at the INFO level to both the screen and the
configured logfile. If the options.debug flag is set, flow
logging is enabled at the DEBUG level to both the screen and the
configured logfile.
|
Sets up and creates logfile as needed. If the logfile already exists on disk, it will be left as-is, under the assumption that it was created with appropriate ownership and permissions. If the logfile does not exist on disk, it will be created as an empty file. Ownership and permissions will remain at their defaults unless user/group and/or mode are set in the options. We ignore errors setting the indicated user and group.
Note:
This function is vulnerable to a race condition. If the log
file does not exist when the function is run, it will attempt to
create the file as safely as possible (using |
|
|
|
|
|
Set up the path resolver singleton based on configuration. Cedar Backup's path resolver is implemented in terms of a singleton, the PathResolverSingleton class. This function takes options configuration, converts it into the dictionary form needed by the singleton, and then initializes the singleton. After that, any function that needs to resolve the path of a command can use the singleton.
|
|
VALID_ACTIONSList of valid actions.
|
SCREEN_LOG_STREAM
|
LONG_SWITCHES
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Sat Nov 15 12:16:53 2008 | http://epydoc.sourceforge.net |