Changes:
* add multi_match argument for NetTestController __init__
* add init of TaskAPI before executing the test
* when folder user in recipe_path, use .py files instead of .xml
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst-ctl | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/lnst-ctl b/lnst-ctl
index 6d656f8..ef70cb1 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -112,7 +112,8 @@ def get_recipe_result(action, file_path, log_ctl, res_serializer,
defined_aliases=defined_aliases,
overriden_aliases=overriden_aliases,
reduce_sync=reduce_sync,
- restrict_pools=pools)
+ restrict_pools=pools,
+ multi_match=multi_match)
except XmlProcessingError as err:
log_exc_traceback()
logging.error(err)
@@ -126,9 +127,13 @@ def get_recipe_result(action, file_path, log_ctl, res_serializer,
res = {}
if matches == 1:
try:
- nettestctl.provision_machines()
- nettestctl.print_match_description()
+ # init TaskAPI.Ctl
+ nettestctl.init_taskapi()
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()
@@ -138,11 +143,10 @@ def get_recipe_result(action, file_path, log_ctl, res_serializer,
retval = RETVAL_ERR
elif matches > 1:
try:
- nettestctl.provision_machines()
+ nettestctl.init_taskapi()
log_ctl.set_recipe(file_path, expand="match_%d" % 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)
except NoMatchError as err:
no_match = True
@@ -337,7 +341,7 @@ def main():
all_files.sort()
for f in all_files:
recipe_file = os.path.join(recipe_path, f)
- if re.match(r'^.*\.xml$', recipe_file):
+ if re.match(r'^.*\.py$', recipe_file):
recipe_files.append(recipe_file)
else:
recipe_files.append(recipe_path)
--
2.4.11