On Fri, Apr 22, 2016 at 10:52:02AM +0200, Jiri Prochazka wrote:
this attribute is set from lnst-ctl and is used in
TaskAPI match() where it stops executing
task phase in match_setup run mode
also it's used in TaskAPI breakpoint(),
because lnst will break only in config_only run_mode
and in run mode it's ignored
it was added because all run modes need to execute python
recipe for which they all use _run_python_task() and this
seemd like best approach
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Controller/NetTestController.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 39e2950..3661f77 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -65,6 +65,8 @@ class NetTestController:
self.remove_saved_machine_config()
+ self.run_mode = "run"
+
self._machines = {}
self._network_bridges = {}
self._tasks = []
@@ -98,6 +100,9 @@ class NetTestController:
self._resource_table["module"] =
self._load_test_modules(modules_dirs)
self._resource_table["tools"] = self._load_test_tools(tools_dirs)
+ def _get_run_mode(self):
+ return self.run_mode
+
Why make a private get method? Inside the class you can just access the
attribute... from other objects/classes you shouldn't use private
methods... And the reverse goes for the attribute, make it private...
> def _get_machineinfo(self, machine_id):
> try:
> info =
self._recipe["machines"][machine_id]["params"]
> @@ -608,9 +613,11 @@ class NetTestController:
> os.remove("/tmp/.lnst_machine_conf")
>
> def match_setup(self):
> + self.run_mode = "match_setup"
> return {"passed": True}
>
> def config_only_recipe(self):
> + self.run_mode = "config_only"
> try:
> self._prepare_network(resource_sync=False)
> except (KeyboardInterrupt, Exception) as exc:
> --
> 2.4.11
> _______________________________________________
> LNST-developers mailing list
> lnst-developers(a)lists.fedorahosted.org
>
https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedoraho...