lnst-ctl now prints log folder path to each recipe run and at the end
of lnst-ctl output path to folder where all logs from runs are stored
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst-ctl | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/lnst-ctl b/lnst-ctl
index 947f3ad..66c617e 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -94,7 +94,8 @@ def get_recipe_result(action, file_path, log_ctl, res_serializer,
no_match = False
log_ctl.set_recipe(file_path, expand="match_%d" % matches)
- recipe_head_log_entry(file_path, matches)
+ log_dir = log_ctl.get_recipe_log_path()
+ recipe_head_log_entry(file_path, log_dir, matches)
res_serializer.add_recipe(file_path, matches)
res = {}
@@ -133,7 +134,7 @@ def get_recipe_result(action, file_path, log_ctl, res_serializer,
try:
nettestctl.provision_machines()
log_ctl.set_recipe(file_path, expand="match_%d" % matches)
- recipe_head_log_entry(file_path, matches)
+ recipe_head_log_entry(file_path, log_dir, matches)
res_serializer.add_recipe(file_path, matches)
nettestctl.print_match_description()
res = exec_action(action, nettestctl)
@@ -165,12 +166,15 @@ def get_recipe_result(action, file_path, log_ctl, res_serializer,
return retval
-def recipe_head_log_entry(filename, match_num=1):
+def recipe_head_log_entry(filename, log_dir, match_num=1):
head_str = "\nTrying recipe file \"%s\" match %d\n" % (filename,
match_num)
- logging.info("-" * len(head_str.strip())
+ log_dir_str = "Logs for this recipe will be stored in '%s'\n" %
log_dir
+ dash_count = max(len(head_str.strip()), len(log_dir_str.strip()))
+ logging.info("-" * dash_count
+ head_str
- + "-" * len(head_str.strip()))
+ + log_dir_str
+ + "-" * dash_count)
def main():
"""
@@ -334,6 +338,8 @@ def main():
res_serializer.print_summary()
+ log_ctl.print_log_dir()
+
if result_path:
result_path = os.path.expanduser(result_path)
handle = open(result_path, "w")
--
2.4.3