Patchwork oeqa/targetcontrol: fix loading a controller using a class name

login
register
mail settings
Submitter Stanacar, StefanX
Date March 7, 2014, 11:34 a.m.
Message ID <1394192045-7063-1-git-send-email-stefanx.stanacar@intel.com>
Download mbox | patch
Permalink /patch/68249/
State Accepted
Commit 724b83d141e33b1d870dbf8210a714a0b118bd04
Headers show

Comments

Stanacar, StefanX - March 7, 2014, 11:34 a.m.
This was wrong and if one would do TEST_TARGET = "SimpleRemoteTarget"
instead of TEST_TARGET = "simpleremote" it would complain
that there is no such controller when there is.

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
 meta/lib/oeqa/targetcontrol.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index d8a6ac0..490810d 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -9,6 +9,7 @@  import shutil
 import subprocess
 import bb
 import traceback
+import sys
 from oeqa.utils.sshcontrol import SSHControl
 from oeqa.utils.qemurunner import QemuRunner
 from oeqa.controllers.testtargetloader import TestTargetLoader
@@ -25,7 +26,7 @@  def get_target_controller(d):
         # use the class name
         try:
             # is it a core class defined here?
-            controller = getattr(__name__, testtarget)
+            controller = getattr(sys.modules[__name__], testtarget)
         except AttributeError:
             # nope, perhaps a layer defined one
             try: