oeqa/targetcontrol: properly get the host ip

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.

(From OE-Core rev: 19af3ac53690b1bd2fee54827090f59c525d2236)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Stefan Stanacar authored and Richard Purdie committed 2014-02-25 17:53:04 +00:00
1 parent 16d271c14b
commit 3ab2b7f10c
1 file changed
+1 -1
+1 -1
View 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)