2016-05-16 8:42 GMT+02:00 Ondrej Lichtner <olichtne(a)redhat.com>:
On Fri, Apr 22, 2016 at 10:52:11AM +0200, Jiri Prochazka wrote:
> this method is run from Task match(), it runs
> matching algorithm, prints match desc, when
> match_setup run mode is used it ends here
>
> otherwise it prepares network, binds Machine objects
> to its HostAPI counterparts and Device objects to
> its InterfaceAPI counterparts
>
> summary - it returns True if it found match and if
> run or config_only mode is used, it also prepares network
> and initializes HostAPI and InterfaceAPI objects created
> in setup phase
>
> Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
> ---
> lnst/Controller/NetTestController.py | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/lnst/Controller/NetTestController.py
b/lnst/Controller/NetTestController.py
> index 8c1d24f..3e7eb69 100644
> --- a/lnst/Controller/NetTestController.py
> +++ b/lnst/Controller/NetTestController.py
> @@ -496,6 +496,25 @@ 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()
> + raise exc
> + return False
You reraise the exception here and the try to return something after
that... I'm surprised that pylint didn't complain about that...
Forgot it there from debugging, sorry for that
>
>> + 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}
>>
>> --
>> 2.4.11
>> _______________________________________________
>> LNST-developers mailing list
>> lnst-developers(a)lists.fedorahosted.org
>>
https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedoraho...