summaryrefslogtreecommitdiffstats
path: root/server/config_data.py
diff options
context:
space:
mode:
authorAdrian Likins <alikins@redhat.com>2007-09-20 17:22:25 -0400
committerAdrian Likins <alikins@redhat.com>2007-09-20 17:22:25 -0400
commitd651fbed4b074046ed00ff13a87eb3cc3af7d3c2 (patch)
treed26134d390fb4f6322c2fb3b23dc5271d9efe4ff /server/config_data.py
parente807123be1eaa599261a160aa0d9fa36f982029b (diff)
parent871efcf4b3dfc05ea722b24b7094dabfe21f9d72 (diff)
downloadthird_party-func-d651fbed4b074046ed00ff13a87eb3cc3af7d3c2.tar.gz
third_party-func-d651fbed4b074046ed00ff13a87eb3cc3af7d3c2.tar.xz
third_party-func-d651fbed4b074046ed00ff13a87eb3cc3af7d3c2.zip
Merge branch 'master' of ssh://git.fedoraproject.org/git/hosted/func
Diffstat (limited to 'server/config_data.py')
-rwxr-xr-xserver/config_data.py33
1 files changed, 12 insertions, 21 deletions
diff --git a/server/config_data.py b/server/config_data.py
index 9ccca75..46d98ec 100755
--- a/server/config_data.py
+++ b/server/config_data.py
@@ -1,11 +1,9 @@
#!/usr/bin/python
-# Virt-factory backend code.
+# func
#
# Copyright 2006, Red Hat, Inc
-# Michael DeHaan <mdehaan@redhat.com>
-# Scott Seago <sseago@redhat.com>
-# Adrian Likins <alikins@redhat.com>
+# see AUTHORS
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
@@ -16,19 +14,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 +29,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