cli()
Implements the command-line interface for the cback
script.
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 standard actions and any of
the configured extended actions (which makes action list verification a
two- step process).
The 'all' action has a special meaning. Normally, it
means that the standard set of actions (collect, stage, store, purge)
will all be executed, in that order. Extended actions will be ignored
as part of the 'all' action.
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:
-
1 : The Python interpreter version is < 2.3
-
2 : Error processing command-line arguments
-
3 : Error configuring logging
-
4 : Error parsing indicated configuration file
-
5 : Backup was interrupted with a CTRL-C or
similar
-
6 : Error executing specified backup actions
-
- Returns:
-
Error code as described above.
Notes:
- This function contains a good amount of logging at the INFO level,
because this is the right place to document high-level flow of control
(i.e. what the command-line options were, what config file was being
used, etc.)
- We assume that anything that must be seen on the screen is
logged at the ERROR level. Errors that occur before logging can be
configured are written to
sys.stderr .
|