]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Fix unit tests under Jenkins
authorZack Cerza <zack@cerza.org>
Tue, 13 May 2014 18:09:04 +0000 (13:09 -0500)
committerZack Cerza <zack@cerza.org>
Tue, 13 May 2014 18:09:04 +0000 (13:09 -0500)
os.getlogin() was throwing:
  OSError: [Errno 25] Inappropriate ioctl for device

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/orchestra/remote.py

index 7c0f0c6e220a521235bdb613783d68a79c672e86..6e7792b80237eeb5f660e99d82d3f1315814a44f 100644 (file)
@@ -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