Patchwork oeqa/targetcontrol: properly get the host ip

login
register
mail settings
Submitter Stanacar, StefanX
Date Feb. 25, 2014, 10:46 a.m.
Message ID <1393325171-2672-1-git-send-email-stefanx.stanacar@intel.com>
Download mbox | patch
Permalink /patch/67397/
State Accepted
Commit 3ab2b7f10cbbcdd8b01036d67dea7567880246ce
Headers show

Comments

Stanacar, StefanX - Feb. 25, 2014, 10:46 a.m.
For the SimpleRemote target where we need the host ip and
it wasn't set in conf, we tried to determine it automatically.
However ip route output isn't the same for every network, we
need the last field from the first line.

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

Patch

diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index ba5e6e5..46e5f7f 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -133,7 +133,7 @@  class SimpleRemoteTarget(BaseTarget):
         self.server_ip = d.getVar("TEST_SERVER_IP", True)
         if not self.server_ip:
             try:
-                self.server_ip = subprocess.check_output(['ip', 'route', 'get', self.ip ]).split()[6]
+                self.server_ip = subprocess.check_output(['ip', 'route', 'get', self.ip ]).split("\n")[0].split()[-1]
             except Exception as e:
                 bb.fatal("Failed to determine the host IP address (alternatively you can set TEST_SERVER_IP with the IP address of this machine): %s" % e)
         bb.note("Server IP: %s" % self.server_ip)