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]
 
globalConfToDict() source code
 
getGlobalConfiguration() source code
 
flagToConfig(flag) source code
 
configToFlag(option) source code
 
_convertConfigLinesToArguments(parser, lines)
Converts configuration file lines of the format:
source code
 
applyGlobalConfToParser(parser) source code
Variables [hide private]
  log = logging.getLogger('zen.GlobalConfig')
  CONFIG_FILE = zenPath('etc', 'global.conf')
  _KEYVALUE = re.compile("^[\s ]*(?P<key>[a-z_]+[a-z0-9_-]*)[\s]...
  _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


Variables Details [hide private]

_KEYVALUE

Value:
re.compile("^[\s ]*(?P<key>[a-z_]+[a-z0-9_-]*)[\s]+(?P<value>[^\s#]+)"\
, re.IGNORECASE).search