From: Zack Cerza Date: Tue, 13 May 2014 18:09:04 +0000 (-0500) Subject: Fix unit tests under Jenkins X-Git-Tag: 1.1.0~1450 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=010f83f19b823125c00ac20e7012e7bb6f915e24;p=teuthology.git Fix unit tests under Jenkins os.getlogin() was throwing: OSError: [Errno 25] Inappropriate ioctl for device Signed-off-by: Zack Cerza --- diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 7c0f0c6e22..6e7792b802 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