# # Author: Bas van der Vlies # Date : 19 Aug 2009 # Desc. : Common functions for the daemon and client program # # SVN INFO # $Id: pxe_global.py.in 170 2009-08-19 08:13:06Z bas $ # $URL: trunk/src/pxe_global.py.in $ # import os import ConfigParser class PxeConfig(Exception): def __init__(self, msg=''): self.msg = msg Exception.__init__(self, msg) def __repr__(self): return self.msg def ReadConfig(): """ Parse the config file """ file = '@pxeconfig_conf@' if not os.path.isfile(file): error = 'File %s does not exist' %file raise PxeConfig, error config = ConfigParser.RawConfigParser() try: config.read(file) except ConfigParser.MissingSectionHeaderError,detail: raise PxeConfig, detail # Not yet uses # #projects = {} #for section in config.sections(): # projects[section] = {} # for option in config.options(section): # projects[section][option] = config.get(section, option) stanza = config.defaults() return stanza