[PATCH 6/8] Task: allow module options to be updated

olichtne at redhat.com olichtne at redhat.com
Fri Jun 12 11:52:10 UTC 2015


From: Ondrej Lichtner <olichtne at redhat.com>

This gives us the ability to reuse the same ModuleAPI object multiple
times but with different options.

Signed-off-by: Ondrej Lichtner <olichtne at redhat.com>
---
 lnst/Controller/Task.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index e350679..e69c348 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -14,6 +14,7 @@ from lnst.Controller.PerfRepo import PerfRepoRESTAPI
 from lnst.Controller.PerfRepo import PerfRepoTestExecution
 from lnst.Controller.PerfRepo import PerfRepoValue
 from lnst.Common.Utils import dot_to_dict, dict_to_dot, list_to_dot
+from lnst.Common.Utils import recursive_dict_update
 from lnst.Common.Config import lnst_config
 
 # The handle to be imported from each task
@@ -391,6 +392,15 @@ class ModuleAPI(object):
             else:
                 self._opts[opt].append({"value": str(val)})
 
+    def update_options(self, options):
+        for opt, val in options.iteritems():
+            self._opts[opt] = []
+            if type(val) == list:
+                for v in val:
+                    self._opts[opt].append({"value": str(v)})
+            else:
+                self._opts[opt].append({"value": str(val)})
+
 class ProcessAPI(object):
     """ An API class representing either a running or finished process. """
 
-- 
2.1.0



More information about the LNST-developers mailing list