commit 83e1735dc85c31f4240729421da299b8351c5b05
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue May 6 10:01:55 2014 +0200
Config: add xslt_url option
This is a Controller specific option, the value is a path or a URL to
the XSLT document that should be referenced in a result xml file if the
option -x is supplied.
The default value points to the xml_to_html.xsl file in this repository
but this should change shortly when we have the files uploaded
somewhere.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst-ctl | 12 ++++++++++--
lnst-ctl.conf | 1 +
lnst/Common/Config.py | 9 +++++++++
3 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/lnst-ctl b/lnst-ctl
index 2dad6aa..ad7ecf7 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -48,6 +48,8 @@ def usage(retval=0):
print " -p, --packet-capture capture and log all ongoing " \
"network communication during the test"
print " -x, --result=FILE file to write xml_result"
+ print " -s, --xslt-url=URL URL to a XSLT document that the
"\
+ "result xml will reference, only usefull when -x is used as
well"
print " -r, --reduce-sync reduces resource synchronization
"\
"for python tasks, see documentation"
sys.exit(retval)
@@ -123,10 +125,10 @@ def main():
try:
opts, args = getopt.getopt(
sys.argv[1:],
- "dhrc:x:poma:A:",
+ "dhrc:x:s:poma:A:",
["debug", "help", "config",
"result=",
"packet-capture", "disable-pool-checks",
"no-colours",
- "define_alias", "override_alias",
"reduce-sync"]
+ "define_alias", "override_alias",
"reduce-sync", "xslt-url"]
)
except getopt.GetoptError as err:
print str(err)
@@ -154,6 +156,7 @@ def main():
debug = 0
recipe_path = None
result_path = None
+ xslt_url = None
config_path = None
packet_capture = False
pool_checks = True
@@ -182,6 +185,8 @@ def main():
store_alias(arg, overriden_aliases)
elif opt in ("-r", "--reduce-sync"):
reduce_sync = True
+ elif opt in ("-s", "--xslt-url"):
+ xslt_url = arg
if config_path is not None:
if not os.path.isfile(config_path):
@@ -190,6 +195,9 @@ def main():
else:
lnst_config.load_config(config_path)
+ if xslt_url != None:
+ lnst_config.set_option("environment", "xslt_url", xslt_url)
+
if coloured_output:
coloured_output = not lnst_config.get_option("colours",
"disable_colours")
diff --git a/lnst-ctl.conf b/lnst-ctl.conf
index 584d340..3b32697 100644
--- a/lnst-ctl.conf
+++ b/lnst-ctl.conf
@@ -10,3 +10,4 @@ machine_pool_dirs =
test_tool_dirs = ./test_tools
test_module_dirs = ./test_modules
log_dir = ./Logs
+xslt_url = ./result_xslt/xml_to_html.xsl
diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py
index ffecfb6..975df5a 100644
--- a/lnst/Common/Config.py
+++ b/lnst/Common/Config.py
@@ -69,6 +69,12 @@ class Config():
"additive" : False,
"action" : self.optionPath,
"name" : "resource_dir"}
+ self._options['environment']['xslt_url'] = {
+ "value" : "./result_xslt/xml_to_html.xsl",
+ "additive" : False,
+ "action" : self.optionPlain,
+ "name" : "xslt_url"
+ }
self.colours_scheme()
@@ -263,6 +269,9 @@ class Config():
def optionBool(self, option, cfg_path):
return bool_it(option)
+
+ def optionPlain(self, option, cfg_path):
+ return option
def dump_config(self):
string = ""