commit f93ce47b06b916f3ef760e224895f9330f6f9c0f
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Oct 23 15:55:41 2012 +0200
Config: add new options, update lnst-ctl.conf
This patch adds 2 new options:
'test_module_dirs' which specifies a list of dirs where to look for
Test*.py files
'test_tool_dirs' which specifies a list of dirs where to look for
test_tool packages to be used by slaves
We agreed to use += for some options that work with lists. After this
patch, options that specify a list of values can be used with both '='
and '+='.
To specify a new list replacing the list loaded from previous
configuration files use '=', e.g.
'machine_pool_dirs = ~/.lnst/pool1/ ~/.lnst/pool2/'
To append to the values loaded from previous configuration files use
'+=', e.g.
'machine_pool_dirs += ~/.lnst/pool/'
This patch also updates the lnst-ctl.conf file to the current format.
The default values for the new options will be added later.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Common/Config.py | 28 ++++++++++++++++++++++------
lnst-ctl.conf | 4 +++-
2 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/Common/Config.py b/Common/Config.py
index 5376f35..889ac4e 100644
--- a/Common/Config.py
+++ b/Common/Config.py
@@ -48,6 +48,8 @@ class Config():
['52:54:01:00:00:01', '52:54:01:FF:FF:FF']
self.options['environment']['rpcport'] = DefaultRPCPort
self.options['environment']['pool_dirs'] = []
+ self.options['environment']['tool_dirs'] = []
+ self.options['environment']['module_dirs'] = []
def init_slave(self):
pass
@@ -120,7 +122,22 @@ class Config():
elif option == 'rpcport':
section['rpcport'] = self.optionPort(config[option])
elif option == 'machine_pool_dirs':
- section['pool_dirs'] = self.optionPoolDirs(config[option],
+ section['pool_dirs'] = self.optionDirList(config[option],
+ cfg_path)
+ elif re.match(r'^machine_pool_dirs\s+\+$', option):
+ section['pool_dirs'] += self.optionDirList(config[option],
+ cfg_path)
+ elif option == 'test_module_dirs':
+ section['module_dirs'] = self.optionDirList(config[option],
+ cfg_path)
+ elif re.match(r'^test_module_dirs\s+\+$', option):
+ section['module_dirs'] += self.optionDirList(config[option],
+ cfg_path)
+ elif option == 'test_tool_dirs':
+ section['tool_dirs'] = self.optionDirList(config[option],
+ cfg_path)
+ elif re.match(r'^test_tool_dirs\s+\+$', option):
+ section['tool_dirs'] += self.optionDirList(config[option],
cfg_path)
else:
msg = "Unknown option: %s in section environment" % option
@@ -154,17 +171,16 @@ class Config():
raise ConfigError(msg)
return vals
- def optionPoolDirs(self, option, cfg_path):
- env = self.get_section('environment')
+ def optionDirList(self, option, cfg_path):
paths = re.split(r'(?<!\\)\s', option)
- pool_dirs = env['pool_dirs']
+ dirs = []
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)
- pool_dirs.append(norm_path)
+ dirs.append(norm_path)
- return pool_dirs
+ return dirs
diff --git a/lnst-ctl.conf b/lnst-ctl.conf
index 422804c..79451b3 100644
--- a/lnst-ctl.conf
+++ b/lnst-ctl.conf
@@ -2,5 +2,7 @@
mac_pool_range = 52:54:01:00:00:01 52:54:01:FF:FF:FF
rpcport = 9999
machine_pool_dirs =
+test_tool_dirs =
+test_module_dirs =
[log]
-path = ./
+path = ./Logs
Show replies by thread