From: Dan Mick Date: Tue, 20 Dec 2016 03:44:52 +0000 (-0800) Subject: spawn_sol_log: use sys.executable to find bin/python X-Git-Tag: 1.1.0~478^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ea3249dbfad435b06bd27f7adcaf37b62411b81b;p=teuthology.git spawn_sol_log: use sys.executable to find bin/python An activated virtualenv has PATH set to find Python with /usr/bin/env. A binary run from virtualenv/bin doesn't set PATH. Use sys.executable to handle both invocation methods. Fixes: http://tracker.ceph.com/issues/17986 Signed-off-by: Dan Mick --- diff --git a/teuthology/orchestra/console.py b/teuthology/orchestra/console.py index ce3f63c9af..83bbf36b60 100644 --- a/teuthology/orchestra/console.py +++ b/teuthology/orchestra/console.py @@ -3,6 +3,7 @@ import os import pexpect import psutil import subprocess +import sys import time from teuthology import lockstatus as ls @@ -282,8 +283,12 @@ class PhysicalConsole(): def start(): console_cmd = self._console_command() + # use sys.executable to find python rather than /usr/bin/env. + # The latter relies on PATH, which is set in a virtualenv + # that's been activated, but is not set when binaries are + # run directly from the virtualenv's bin/ directory. python_cmd = [ - '/usr/bin/env', 'python', '-c', + sys.executable, '-c', pexpect_templ.format( cmd=console_cmd, log=dest_path,