From 010f83f19b823125c00ac20e7012e7bb6f915e24 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 13 May 2014 13:09:04 -0500 Subject: [PATCH] Fix unit tests under Jenkins os.getlogin() was throwing: OSError: [Errno 25] Inappropriate ioctl for device Signed-off-by: Zack Cerza --- teuthology/orchestra/remote.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 7c0f0c6e220a5..6e7792b80237e 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -11,6 +11,7 @@ import logging from cStringIO import StringIO from teuthology import lockstatus as ls import os +import pwd import tempfile try: @@ -38,7 +39,9 @@ class Remote(object): if '@' in name: (self.user, self.hostname) = name.split('@') else: - self.user = os.getlogin() + # os.getlogin() doesn't work on non-login shells. The following + # should work on any unix system + self.user = pwd.getpwuid(os.getuid()).pw_name self.hostname = name self._shortname = shortname self.host_key = host_key -- 2.39.5