Resending version 2 of the patch. I moved the code for generating log
entry into a function to avoid code duplication.
This is a patch that would slightly enhance readability of controller
log.
First change is addition of a missing log entry when recipes are passed
as
individual files.
Second change is modification of the log entry so it's obvious that
another recipe's being processed.
Before,
# ./lnst-ctl run recipes/team/
Loading config file '/root/lnst/lnst-ctl.conf'
Loading config file '/root/.lnst/lnst-ctl.conf'
2013-11-20 09:12:17 (localhost) INFO: Processing recipe file
"recipes/team/recipex_ab_001.xml"
2013-11-20 09:12:17 (localhost) INFO: Checking machine pool availability.
...
After,
# ./lnst-ctl run recipes/team/
Loading config file '/root/lnst/lnst-ctl.conf'
Loading config file '/root/.lnst/lnst-ctl.conf'
2013-11-20 09:14:43 (localhost) INFO:
--------------------------------------------------------
Processing recipe file "recipes/team/recipex_ab_001.xml"
--------------------------------------------------------
2013-11-20 09:14:43 (localhost) INFO: Checking machine pool availability.
...
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst-ctl | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lnst-ctl b/lnst-ctl
index d597c23..fadeeb8 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -106,6 +106,12 @@ def get_recipe_result(args, file_path, res_serializer,
packet_capture,
return (file_path, res, retval)
+def recipe_head_log_entry(filename)
+ head_str = "\nProcessing recipe file \"%s\"\n" % filename
+ logging.info("-" * len(head_str.strip())
+ + head_str
+ + "-" * len(head_str.strip()))
+
def main():
"""
Main function
@@ -213,7 +219,7 @@ def main():
for f in all_files:
recipe_file = os.path.join(recipe_path, f)
if re.match(r'^.*\.xml$', recipe_file):
- logging.info("Processing recipe file \"%s\"" %
recipe_file)
+ recipe_head_log_entry(recipe_file)
fp, res, rv = get_recipe_result(action, recipe_file,
res_serializer,
packet_capture,
@@ -221,6 +227,7 @@ def main():
defined_aliases,
overriden_aliases)
else:
+ recipe_head_log_entry(recipe_path)
fp, res, rv = get_recipe_result(action, recipe_path,
res_serializer,
packet_capture,
--
1.8.1.4
Show replies by date