commit 47ba471be146235d8c47c3b2f5246880e1667cb2 Author: Jan Tluka jtluka@redhat.com Date: Mon Jul 21 16:45:49 2014 +0200
NetTestController: fix url handling for python tasks
The python task pathname was not handled properly if recipe was specified as url, e.g.
lnst-ctl -d run http://example.net/recipe.xml
The fix is to use abstract class RecipePath for python task pathnames in the recipe.
Signed-off-by: Jan Tluka jtluka@redhat.com Signed-off-by: Jiri Pirko jiri@resnulli.us
lnst/Controller/NetTestController.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) --- diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py index 3c33d68..58a17b4 100644 --- a/lnst/Controller/NetTestController.py +++ b/lnst/Controller/NetTestController.py @@ -312,10 +312,10 @@ class NetTestController:
if "python" in task_data: root = RecipePath(None, self._recipe_path).get_root() - path = "%s/%s" % (root, task_data["python"]) + path = RecipePath(root, task_data["python"])
task["python"] = path - if not os.path.isfile(path): + if not path.exists(): msg = "Task file '%s' not found." % path raise RecipeError(msg, task_data)
@@ -635,8 +635,9 @@ class NetTestController: # Initialize the API handle Task.ctl = Task.ControllerAPI(self, self._machines)
- name = os.path.basename(task["python"]).split(".")[0] - module = imp.load_source(name, task["python"]) + task_path = task["python"] + name = os.path.basename(task_path.abs_path()).split(".")[0] + module = imp.load_source(name, task_path.resolve())
#restore resource table self._resource_table = res_table_bkp
lnst-developers@lists.fedorahosted.org