getpass.getuser() eventually also calls pwd.getpwuid(os.getuid())[0],
but first checks whether there's any of LOGNAME, USER, LNAME and USERNAME
env. variables set. If yes, then it returns its value.
This is useful in Openshift where a container has random uid
and getpwuid(random_uid) fails with:
KeyError: 'getpwuid(): uid not found: random_uid'
getpass.getuser() eventually also calls pwd.getpwuid(os.getuid())[0],
but first checks whether there's any of LOGNAME, USER, LNAME and USERNAME
env. variables set. If yes, then it returns its value.
This is useful in Openshift where a container has random uid
and getpwuid(random_uid) fails with:
KeyError: 'getpwuid(): uid not found: random_uid'
Signed-off-by: Jiri Popelka jpopelka@redhat.com