diff options
author | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-09-20 16:22:42 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-09-20 16:22:42 -0400 |
commit | 2d318c3c0e7a615552e8c5ca103614be0b40eab7 (patch) | |
tree | e0558a94c3ba516841bd3036d4207e1087c7048e /server/config_data.py | |
parent | 7b335ce91ff9520dc46e7d80e526ae19e4b27900 (diff) | |
download | third_party-func-2d318c3c0e7a615552e8c5ca103614be0b40eab7.tar.gz third_party-func-2d318c3c0e7a615552e8c5ca103614be0b40eab7.tar.xz third_party-func-2d318c3c0e7a615552e8c5ca103614be0b40eab7.zip |
Basic config file. Intentionally short. Slowly removing VF code.
Diffstat (limited to 'server/config_data.py')
-rwxr-xr-x | server/config_data.py | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/server/config_data.py b/server/config_data.py index 9ccca75..bda7635 100755 --- a/server/config_data.py +++ b/server/config_data.py @@ -16,19 +16,10 @@ from codes import * - import os -import yaml - -CONFIG_FILE = "/etc/virt-factory/settings" - -# from the comments in http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531 -#class Singleton(object): -# def __new__(type): -# if not '_the_instance' in type.__dict__: -# type._the_instance = object.__new__(type) -# return type._the_instance +import ConfigParser +CONFIG_FILE = "/etc/func/settings" class Config: @@ -40,16 +31,18 @@ class Config: self.__dict__ = self.__shared_state if not self.has_read: self.read() - print "***** CONFIG RELOAD *****" Config.has_read = True def read(self): + if not os.path.exists(CONFIG_FILE): - raise MisconfiguredException(comment="Missing %s" % CONFIG_FILE) - config_file = open(CONFIG_FILE) - data = config_file.read() - self.ds = yaml.load(data).next() - + raise FuncException(comment="Missing %s" % CONFIG_FILE) + + cp = ConfigParser.ConfigParser() + + self.ds["is_master"] = int(cp.get("general","is_master")) + self.ds["is_minion"] = int(cp.get("general","is_minion")) + self.ds["master_server"] = cp.get("general","master") def get(self): return self.ds |