prepare_test_env methods purpose is provisioning of the setup and initializing of TaskAPI objects which represent hosts and interfaces. It will be used only in upcoming PyRecipes implementation.
init_taskapi just creates instance of TaskAPI class. This instance is now created in _run_python_task but in upcoming patches it will be removed from there.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com --- lnst/Controller/NetTestController.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py index fb6ab75..0115d2f 100644 --- a/lnst/Controller/NetTestController.py +++ b/lnst/Controller/NetTestController.py @@ -678,6 +678,24 @@ class NetTestController:
return res
+ def prepare_test_env(self): + try: + self.provision_machines() + self.print_match_description() + if self.run_mode == "match_setup": + return True + self._prepare_network() + Task.ctl.init_hosts(self._machines) + return True + except (NoMatchError) as exc: + self._cleanup_slaves() + return False + except (KeyboardInterrupt, Exception) as exc: + msg = "Exception raised during configuration." + logging.error(msg) + self._cleanup_slaves() + raise + def _run_recipe(self): overall_res = {"passed": True}
@@ -703,6 +721,9 @@ class NetTestController:
return overall_res
+ def init_taskapi(self): + Task.ctl = Task.ControllerAPI(self) + def _run_python_task(self, task): #backup of resource table res_table_bkp = copy.deepcopy(self._resource_table)