]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
spawn_sol_log: use sys.executable to find bin/python 1003/head
authorDan Mick <dan.mick@redhat.com>
Tue, 20 Dec 2016 03:44:52 +0000 (19:44 -0800)
committerDan Mick <dan.mick@redhat.com>
Wed, 21 Dec 2016 18:25:47 +0000 (10:25 -0800)
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 <dan.mick@redhat.com>
teuthology/orchestra/console.py

index ce3f63c9aff6f6d5478c1c964900ee8051386752..83bbf36b6063da33e1b88d545fe9df10bf55850a 100644 (file)
@@ -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,