summaryrefslogtreecommitdiff
path: root/src/leap/base
diff options
context:
space:
mode:
authorantialias <antialias@leap.se>2013-01-24 11:39:21 -0500
committerantialias <antialias@leap.se>2013-01-24 11:39:21 -0500
commitd02402a147bbae945618befdb8a1a260a91ce7a6 (patch)
tree05a644b15ddabb317874079aa503690287a5ad18 /src/leap/base
parentcbdd369c00fda7e8d04dc2c422cbab9d5ad59c7d (diff)
changed get_username to work on buildslaves
Diffstat (limited to 'src/leap/base')
-rw-r--r--src/leap/base/config.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/leap/base/config.py b/src/leap/base/config.py
index e235e5c3..7021cb0f 100644
--- a/src/leap/base/config.py
+++ b/src/leap/base/config.py
@@ -333,7 +333,14 @@ def validate_ip(ip_str):
def get_username():
- return os.getlogin()
+ try:
+ return os.getlogin()
+ except OSError as e:
+ if e.message == "[Errno 22] Invalid argument":
+ import pwd
+ return pwd.getpwuid(os.getuid())[0]
+ else:
+ raise OSError(e.message)
def get_groupname():