From 11e61e035999da5aff22522efeaeadbbe5ba6f85 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Wed, 11 Nov 2009 18:12:00 +0000 Subject: [PATCH] use defaults for SFA_CONFIG_DIR and SFA_DATA_DIR if not found in config file --- sfa/util/config.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sfa/util/config.py b/sfa/util/config.py index b6c62c0b..37f30386 100644 --- 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 + self.data_path = None 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) + # 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 -- 2.43.0