Allow using ssh-agent
diff --git a/jeepyb/utils.py b/jeepyb/utils.py
index a0be878..8d726e6 100644
--- a/jeepyb/utils.py
+++ b/jeepyb/utils.py
@@ -88,9 +88,14 @@
def make_ssh_wrapper(gerrit_user, gerrit_key):
(fd, name) = tempfile.mkstemp(text=True)
os.write(fd, b'#!/bin/bash\n')
- os.write(fd,
- b'ssh -i %s -l %s -o "StrictHostKeyChecking no" $@\n' %
- (gerrit_key.encode('utf-8'), gerrit_user.encode('utf-8')))
+ if gerrit_key is None:
+ os.write(fd,
+ b'ssh -l %s -o "StrictHostKeyChecking no" $@\n' %
+ (gerrit_user.encode('utf-8')))
+ else:
+ os.write(fd,
+ b'ssh -i %s -l %s -o "StrictHostKeyChecking no" $@\n' %
+ (gerrit_key.encode('utf-8'), gerrit_user.encode('utf-8')))
os.close(fd)
os.chmod(name, 0o755)
return dict(GIT_SSH=name)