Don't use shlex.split in subprocess call and also prepend . /etc/profile, because PATH over ssh is always /usr/bin:/bin which isn't what many tests expect.
Signed-off-by: Stefan Stanacar <stefanx.stana...@intel.com> --- meta/lib/oeqa/utils/sshcontrol.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/meta/lib/oeqa/utils/sshcontrol.py b/meta/lib/oeqa/utils/sshcontrol.py index 85a09a0..9aa30fd 100644 --- a/meta/lib/oeqa/utils/sshcontrol.py +++ b/meta/lib/oeqa/utils/sshcontrol.py @@ -1,7 +1,6 @@ import subprocess import time import os -import shlex class SSHControl(object): @@ -18,8 +17,12 @@ class SSHControl(object): f.write("%s\n" % msg) def _internal_run(self, cmd): + # We need this for a proper PATH + cmd = ". /etc/profile; " + cmd + command = ['ssh', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', '-l', 'root', self.host, cmd ] + self.log("[Running]$ %s" % " ".join(command)) # ssh hangs without os.setsid - proc = subprocess.Popen(shlex.split(cmd), shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, preexec_fn=os.setsid) + proc = subprocess.Popen(command, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, preexec_fn=os.setsid) return proc def run(self, cmd, timeout=None): @@ -30,15 +33,12 @@ class SSHControl(object): - actualcmd = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root %s '%s'" % (self.host, cmd) if self.host: - sshconn = self._internal_run(actualcmd) + sshconn = self._internal_run(cmd) else: raise Exception("Remote IP hasn't been set: '%s'" % actualcmd) if timeout == 0: - self.log("[SSH run without timeout]$ %s" % actualcmd) - self.log(" # %s" % cmd) self._out = sshconn.communicate()[0] self._ret = sshconn.poll() else: @@ -48,8 +48,6 @@ class SSHControl(object): endtime = time.time() + timeout while sshconn.poll() is None and time.time() < endtime: time.sleep(1) - self.log("[SSH run with timeout]$ %s" % actualcmd) - self.log(" # %s" % cmd) # process hasn't returned yet if sshconn.poll() is None: self._ret = 255 -- 1.8.1.4 _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core