git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
17baaa1
)
use defaults for SFA_CONFIG_DIR and SFA_DATA_DIR if not found in config file
author
Tony Mack
<tmack@cs.princeton.edu>
Wed, 11 Nov 2009 18:12:00 +0000
(18:12 +0000)
committer
Tony Mack
<tmack@cs.princeton.edu>
Wed, 11 Nov 2009 18:12:00 +0000
(18:12 +0000)
sfa/util/config.py
patch
|
blob
|
history
diff --git
a/sfa/util/config.py
b/sfa/util/config.py
index
b6c62c0
..
37f3038
100644
(file)
--- a/
sfa/util/config.py
+++ b/
sfa/util/config.py
@@
-31,13
+31,24
@@
class Config:
def __init__(self, config_file = "/etc/sfa/sfa_config"):
self.config_file = None
self.config_path = None
def __init__(self, config_file = "/etc/sfa/sfa_config"):
self.config_file = None
self.config_path = None
+ self.data_path = None
self.load(config_file)
def load(self, config_file):
try:
execfile(config_file, self.__dict__)
self.config_file = config_file
self.load(config_file)
def load(self, config_file):
try:
execfile(config_file, self.__dict__)
self.config_file = config_file
+ # path to configuration data
self.config_path = os.path.dirname(config_file)
self.config_path = os.path.dirname(config_file)
+ # path to server data
+ if not hasattr(self, 'SFA_DATA_DIR'):
+ # default to /var/lib/sfa not specified in config
+ self.SFA_DATA_DIR="/var/lib/sfa"
+ # path to config data
+ if not hasattr(self, 'SFA_CONFIG_DIR'):
+ # default to /var/lib/sfa not specified in config
+ self.SFA_CONFIG_DIR="/etc/sfa"
+
except IOError, e:
raise IOError, "Could not find the configuration file: %s" % config_file
except IOError, e:
raise IOError, "Could not find the configuration file: %s" % config_file