Skip to content

Commit 34cb607

Browse files
cgwaltersjlebon
authored andcommitted
kola: Set MANTLE_SSH_DIR
Requires: coreos/mantle#1081 So the ssh agent is in a predictable place, and one doesn't have to guess among the 10s of random `/tmp/mantle-ssh-<tmp>` directories. This way we can document doing e.g.: ``` $ env SSH_AUTH_SOCK=tmp/kola-ssh ssh -p <port> [email protected] ``` to debug local qemu-unpriv VMs, etc.
1 parent 3811a9d commit 34cb607

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/cmd-kola

+11-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import subprocess
55
import json
66
import os
77
import sys
8+
import shutil
89

910
cosa_dir = os.path.dirname(os.path.abspath(__file__))
1011
sys.path.insert(0, cosa_dir)
@@ -61,4 +62,13 @@ kolaargs.extend(args.subargs)
6162

6263
# flush before exec; see https://docs.python.org/3.7/library/os.html#os.execvpe
6364
print(subprocess.list2cmdline(kolaargs), flush=True)
64-
os.execvp('kola', kolaargs)
65+
env = dict(os.environ)
66+
# By default, store ssh agent in tmp/ too so it can be
67+
# conveniently found.
68+
if args.output_dir is None:
69+
kola_ssh_dir = 'tmp/kola-ssh'
70+
if os.path.isdir(kola_ssh_dir):
71+
shutil.rmtree(kola_ssh_dir)
72+
os.mkdir(kola_ssh_dir)
73+
env['MANTLE_SSH_DIR'] = kola_ssh_dir
74+
os.execvpe('kola', kolaargs, env)

0 commit comments

Comments
 (0)