From ea3249dbfad435b06bd27f7adcaf37b62411b81b Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Mon, 19 Dec 2016 19:44:52 -0800 Subject: [PATCH] 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 --- teuthology/orchestra/console.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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, -- 2.39.5