From: Ondrej Lichtner olichtne@redhat.com
Just a cosmetic change to the default value of logging path. Previously it would be set to ././Logs, now it is expanded to an absolute path.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- Common/Config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Common/Config.py b/Common/Config.py index 889ac4e..ecdebc8 100644 --- a/Common/Config.py +++ b/Common/Config.py @@ -40,8 +40,8 @@ class Config():
def init_controller(self): self.options['log'] = dict() - self.options['log']['path'] = os.path.join( - os.path.dirname(sys.argv[0]), './Logs') + self.options['log']['path'] = os.path.abspath(os.path.join( + os.path.dirname(sys.argv[0]), './Logs'))
self.options['environment'] = dict() self.options['environment']['mac_pool_range'] = \
From: Ondrej Lichtner olichtne@redhat.com
The slave configuration now accepts section '[cache]' and an option 'cache_dir' under it. This option controls where the slave will look for and store test modules and test tools that we will be transmitting through our rpc connection.
This patch also changes the lnst-slave.conf to reflect this change. The default value used for this option is './cache' which will be used by the git version of lnst.
There is also a minor change in the name of the method optionLogPath to just optionPath as it isn't related to logs directly.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- Common/Config.py | 30 +++++++++++++++++++++++------- lnst-slave.conf | 2 ++ 2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/Common/Config.py b/Common/Config.py index ecdebc8..41438a6 100644 --- a/Common/Config.py +++ b/Common/Config.py @@ -52,7 +52,9 @@ class Config(): self.options['environment']['module_dirs'] = []
def init_slave(self): - pass + self.options['cache'] = dict() + self.options['cache']['dir'] = os.path.abspath(os.path.join( + os.path.dirname(sys.argv[0]), './cache'))
def get_config(self): return self.options @@ -99,7 +101,12 @@ class Config(): raise ConfigError(msg)
def sectionsSlave(self, sections, path): - pass + for section in sections: + if section == "cache": + self.sectionCache(sections[section], path) + else: + msg = "Unknown section: %s" % section + raise ConfigError(msg)
def sectionLogs(self, config, cfg_path): section = self.options['log'] @@ -107,11 +114,22 @@ class Config(): config.pop('__name__', None) for option in config: if option == 'path': - section['path'] = self.optionLogPath(config[option], cfg_path) + section['path'] = self.optionPath(config[option], cfg_path) else: msg = "Unknown option: %s in section log" % option raise ConfigError(msg)
+ def sectionCache(self, config, cfg_path): + section = self.options['cache'] + + config.pop('__name__', None) + for option in config: + if option == 'cache_dir': + section['dir'] = self.optionPath(config[option], cfg_path) + else: + msg = "Unknown option: %s in section cache" % option + raise ConfigError(msg) + def sectionEnvironment(self, config, cfg_path): section = self.options['environment']
@@ -151,7 +169,7 @@ class Config(): raise ConfigError(msg) return int(option)
- def optionLogPath(self, option, cfg_path): + def optionPath(self, option, cfg_path): exp_path = os.path.expanduser(option) abs_path = os.path.join(os.path.dirname(cfg_path), exp_path) norm_path = os.path.normpath(abs_path) @@ -178,9 +196,7 @@ class Config(): for path in paths: if path == '': continue - exp_path = os.path.expanduser(path) - abs_path = os.path.join(os.path.dirname(cfg_path), exp_path) - norm_path = os.path.normpath(abs_path) + norm_path = self.optionPath(path, cfg_path) dirs.append(norm_path)
return dirs diff --git a/lnst-slave.conf b/lnst-slave.conf index e69de29..6a9bfe1 100644 --- a/lnst-slave.conf +++ b/lnst-slave.conf @@ -0,0 +1,2 @@ +[cache] +cache_dir = ./cache
lnst-developers@lists.fedorahosted.org