diff options
author | antialias <antialias@leap.se> | 2013-01-24 11:39:21 -0500 |
---|---|---|
committer | antialias <antialias@leap.se> | 2013-01-24 11:39:21 -0500 |
commit | d02402a147bbae945618befdb8a1a260a91ce7a6 (patch) | |
tree | 05a644b15ddabb317874079aa503690287a5ad18 /src | |
parent | cbdd369c00fda7e8d04dc2c422cbab9d5ad59c7d (diff) |
changed get_username to work on buildslaves
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/base/config.py | 9 |
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(): |