Last change
on this file since 170 was
170,
checked in by bas, 14 years ago
|
pxe_global.py:
- moved some more functions to the library the exception Class
src/pxeconfigd.py:
- just import the server side as module
|
-
Property svn:keywords set to
Id URL
|
File size:
945 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 170 2009-08-19 08:13:06Z bas $ |
---|
8 | # $URL: trunk/src/pxe_global.py.in $ |
---|
9 | # |
---|
10 | import os |
---|
11 | import ConfigParser |
---|
12 | |
---|
13 | class 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 | |
---|
21 | def 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 stanza |
---|
Note: See
TracBrowser
for help on using the repository browser.