]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/targetcontrol: properly get the host ip
authorStefan Stanacar <stefanx.stanacar@intel.com>
Tue, 25 Feb 2014 10:46:11 +0000 (12:46 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 25 Feb 2014 17:50:46 +0000 (17:50 +0000)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/targetcontrol.py

index ba5e6e5dc1be4454fca3647e995116a75e97ad16..46e5f7fa6b5ea6c368695fa893a932996f06bc71 100644 (file)
@@ -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)