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

Module GlobalConfig

source code

Classes [hide private]
GlobalConfig
A method for retrieving the global configuration options outside of a daemon.
_GlobalConfParserAdapter
Functions [hide private]
 
getGlobalConfiguration() source code
 
_convertConfigLinesToArguments(parser, lines)
Converts configuration file lines of the format:
source code
 
applyGlobalConfToParser(parser) source code
Variables [hide private]
  CONFIG_FILE = zenPath('etc', 'global.conf')
  _GLOBAL_CONFIG = ConfigLoader(CONFIG_FILE, GlobalConfig)
Function Details [hide private]

_convertConfigLinesToArguments(parser, lines)

source code 

Converts configuration file lines of the format:

   myoption 1
   mybooloption False

to the equivalent command-line arguments for the specified OptionParser.
For example, the configuration file above would return the argument
list ['--myoption', '1', '--mybooloption'] if mybooloption has action
store_false, and ['--myoption', '1'] if mybooloption has action store_true.

@parameter parser: OptionParser object containing configuration options.
@type parser: OptionParser
@parameter lines: List of dictionary object parsed from a configuration file.
                  Each option is expected to have 'type', 'key', 'value' entries.
@type lines: list of dictionaries.
@return: List of command-line arguments corresponding to the configuration file.
@rtype: list of strings