set applied, thanks
Mon, Oct 27, 2014 at 05:11:41PM CET, olichtne(a)redhat.com wrote:
From: Ondrej Lichtner <olichtne(a)redhat.com>
This patch spparates the code for the first match of a recipe from the
code for additional matches. This fixes a few issues introduced in the
multi match support patches, such as wrong error reporting when no
suitable match was found.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst-ctl | 49 ++++++++++++++++++++++++++++++-------------------
1 file changed, 30 insertions(+), 19 deletions(-)
diff --git a/lnst-ctl b/lnst-ctl
index 9d72503..5f3b22f 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -98,29 +98,40 @@ def get_recipe_result(action, file_path, log_ctl, res_serializer,
no_match = False
while True:
res = {}
- try:
- nettestctl.provision_machines()
- log_ctl.set_recipe(file_path, expand="match_%d" % matches)
- recipe_head_log_entry(file_path, matches)
- nettestctl.print_match_description()
- res_serializer.add_recipe(file_path, matches)
- res = exec_action(action, nettestctl)
- except NoMatchError as err:
- no_match = True
- if matches == 1:
+ if matches == 1:
+ try:
+ log_ctl.set_recipe(file_path, expand="match_%d" % matches)
+ recipe_head_log_entry(file_path, matches)
+ res_serializer.add_recipe(file_path, matches)
+ nettestctl.provision_machines()
+ nettestctl.print_match_description()
+ res = exec_action(action, nettestctl)
+ except Exception as err:
+ no_match = True
+ log_exc_traceback()
+ logging.error(err)
res["passed"] = False
+ res["err_msg"] = str(err)
retval = RETVAL_ERR
- raise err
- else:
+ elif matches > 1:
+ try:
+ nettestctl.provision_machines()
+ log_ctl.set_recipe(file_path, expand="match_%d" % matches)
+ recipe_head_log_entry(file_path, matches)
+ res_serializer.add_recipe(file_path, matches)
+ nettestctl.print_match_description()
+ res = exec_action(action, nettestctl)
+ except NoMatchError as err:
+ no_match = True
log_ctl.unset_recipe()
logging.warning("Match %d not possible." % matches)
- except Exception as err:
- no_match = True
- log_exc_traceback()
- logging.error(err)
- res["passed"] = False
- res["err_msg"] = str(err)
- retval = RETVAL_ERR
+ except Exception as err:
+ no_match = True
+ log_exc_traceback()
+ logging.error(err)
+ res["passed"] = False
+ res["err_msg"] = str(err)
+ retval = RETVAL_ERR
if no_match and matches > 1:
break
--
1.9.3
_______________________________________________
LNST-developers mailing list
LNST-developers(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers