From d02402a147bbae945618befdb8a1a260a91ce7a6 Mon Sep 17 00:00:00 2001 From: antialias Date: Thu, 24 Jan 2013 11:39:21 -0500 Subject: changed get_username to work on buildslaves --- src/leap/base/config.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') 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(): -- cgit v1.2.3