Patchwork oeqa/targetcontrol: allow a custom port for SimpleRemoteTarget

login
register
mail settings
Submitter Stanacar, StefanX
Date March 7, 2014, 11:08 a.m.
Message ID <1394190510-4316-1-git-send-email-stefanx.stanacar@intel.com>
Download mbox | patch
Permalink /patch/68247/
State Accepted
Commit 517bc165bb96cfc62da8fde23abc315981941d49
Headers show

Comments

Stanacar, StefanX - March 7, 2014, 11:08 a.m.
We had the ability to use a custom port for the ssh connection,
but we weren't using it.

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

Patch

diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index d8a6ac0..17871f5 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -144,7 +144,12 @@  class SimpleRemoteTarget(BaseTarget):
 
     def __init__(self, d):
         super(SimpleRemoteTarget, self).__init__(d)
-        self.ip = d.getVar("TEST_TARGET_IP", True) or bb.fatal('Please set TEST_TARGET_IP with the IP address of the machine you want to run the tests on.')
+        addr = d.getVar("TEST_TARGET_IP", True) or bb.fatal('Please set TEST_TARGET_IP with the IP address of the machine you want to run the tests on.')
+        self.ip = addr.split(":")[0]
+        try:
+            self.port = addr.split(":")[1]
+        except IndexError:
+            self.port = None
         bb.note("Target IP: %s" % self.ip)
         self.server_ip = d.getVar("TEST_SERVER_IP", True)
         if not self.server_ip:
@@ -158,7 +163,7 @@  class SimpleRemoteTarget(BaseTarget):
         super(SimpleRemoteTarget, self).deploy()
 
     def start(self, params=None):
-        self.connection = SSHControl(self.ip, logfile=self.sshlog)
+        self.connection = SSHControl(self.ip, logfile=self.sshlog, port=self.port)
 
     def stop(self):
         self.connection = None