source: trunk/src/pxe_global.py.in

Last change on this file was 186, checked in by bas, 13 years ago

Added mac address support for environments that have dynamic ip's. Depended on arp command

  • Property svn:keywords set to Id URL
File size: 953 bytes
Line 
1#
2# Author: Bas van der Vlies
3# Date  : 19 Aug 2009
4# Desc. : Common functions for the daemon and client program
5#
6# SVN INFO
7#       $Id: pxe_global.py.in 186 2010-10-28 14:04:25Z bas $
8#       $URL: trunk/src/pxe_global.py.in $
9#
10import os
11import ConfigParser
12
13class PxeConfig(Exception):
14       def __init__(self, msg=''):
15               self.msg = msg
16               Exception.__init__(self, msg)
17
18       def __repr__(self):
19               return self.msg
20
21def ReadConfig():
22        """
23        Parse the config file
24        """
25        file = '@pxeconfig_conf@'
26
27        if not os.path.isfile(file):
28                error = 'File %s does not exist' %file
29                raise PxeConfig, error
30
31        config = ConfigParser.RawConfigParser()
32        try:
33                config.read(file)
34        except ConfigParser.MissingSectionHeaderError,detail:
35                raise PxeConfig, detail
36
37        # Not yet uses
38        #
39        #projects = {}
40        #for section in config.sections():
41        #       projects[section] = {}
42        #       for option in  config.options(section):
43        #       projects[section][option] = config.get(section, option)
44
45        stanza = config.defaults()
46        return config, stanza
Note: See TracBrowser for help on using the repository browser.