Package Products :: Package ZenUtils :: Module CmdBase :: Class CmdBase |
[hide private]
[frames] | no frames]

# Class CmdBase

source code

    object --+
             |
            CmdBase

Known Subclasses:
  - ZenBackupBase.ZenBackupBase
  - , ZenDaemon.ZenDaemon
  - , ZenEvents.xtest.XTest
  - , ZenScriptBase.ZenScriptBase
  - , ZenEvents.zensendsyslog.ZenSendSyslog
  - , ZenModel.zenbuild.zenbuild
  - , ConfDaemon.ConfDaemon

Class used for all Zenoss commands

Instance Methods | [hide private]
__init__(self, noopts=0, args=None) | source code
buildParser(self) Create the options parser | source code
buildOptions(self) Basic options setup. | source code
parseOptions(self) Uses the optparse parse previously populated and performs common options. | source code
getConfigFileDefaults(self, filename) Parse a config file which has key-value pairs delimited by white space, and update the parser's option defaults with these values. | source code
getGlobalConfigFileDefaults(self) Parse a config file which has key-value pairs delimited by white space, and update the parser's option defaults with these values. | source code
loadConfigFile(self, filename) Parse a config file which has key-value pairs delimited by white space. | source code
validateConfigFile(self, filename, lines, correctErrors=True, warnErrors=True) Validate config file lines which has key-value pairs delimited by white space, and validate that the keys exist for this command's option parser. | source code
getParamatersFromConfig(self, lines) | source code
setupLogging(self) Set common logging options | source code
checkLogpath(self) Validate the logpath is valid | source code
pretty_print_config_comment(self, comment) Quick and dirty pretty printer for comments that happen to be longer than can comfortably be seen on the display. | source code
generate_configs(self, parser, options) Create a configuration file based on the long-form of the option names | source code
generate_xml_table(self, parser, options) Create a Docbook table based on the long-form of the option names | source code
generate_xml_configs(self, parser, options) Create an XML file that can be used to create Docbook files as well as used as the basis for GUI-based daemon option configuration. | source code

Class Variables | [hide private]
| doesLogging = `True`

Method Details | [hide private]

### __init__(self, noopts=0, args=None) (Constructor) | source code
Overrides: object.__init__ (inherited documentation)

### buildOptions(self) | source code
Basic options setup. Other classes should call this before adding more options

### getConfigFileDefaults(self, filename) | source code
Parse a config file which has key-value pairs delimited by white space, and update the parser's option defaults with these values. Parameters: `filename` (string) - name of configuration file

### loadConfigFile(self, filename) | source code
Parse a config file which has key-value pairs delimited by white space. Parameters: `filename` (string) - path to the configuration file

### validateConfigFile(self, filename, lines, correctErrors=True, warnErrors=True) | source code
Validate config file lines which has key-value pairs delimited by white space, and validate that the keys exist for this command's option parser. If the option does not exist or has an empty value it will comment it out in the config file. Parameters: `filename` (string) - path to the configuration file `lines` (list) - lines from config parser `correctErrors` (boolean) - Whether or not invalid conf values should be commented out.

### generate_configs(self, parser, options) | source code
Create a configuration file based on the long-form of the option names Parameters: `parser` - an optparse parser object which contains defaults, help `options` - parsed options list containing actual values

### generate_xml_table(self, parser, options) | source code
Create a Docbook table based on the long-form of the option names Parameters: `parser` - an optparse parser object which contains defaults, help `options` - parsed options list containing actual values