diff options
author | Seth Vidal <skvidal@fedoraproject.org> | 2013-07-04 15:23:16 -0400 |
---|---|---|
committer | Seth Vidal <skvidal@fedoraproject.org> | 2013-07-04 15:23:16 -0400 |
commit | 272a6b10b55d61e65fa28bf1ee84d217913d317c (patch) | |
tree | 0567e0c3c0a93c70b898221b91ec2c69a451f4c1 /callback_plugins | |
parent | 4ea5bc2a425d85d90f36c4318949f7c64f6fcd73 (diff) | |
download | ansible-272a6b10b55d61e65fa28bf1ee84d217913d317c.tar.gz ansible-272a6b10b55d61e65fa28bf1ee84d217913d317c.tar.xz ansible-272a6b10b55d61e65fa28bf1ee84d217913d317c.zip |
try os.getlogin() first then fall back to os.geteuid()
Diffstat (limited to 'callback_plugins')
-rw-r--r-- | callback_plugins/logdetail.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/callback_plugins/logdetail.py b/callback_plugins/logdetail.py index 1433ef7f4..3d19fcca8 100644 --- a/callback_plugins/logdetail.py +++ b/callback_plugins/logdetail.py @@ -28,7 +28,11 @@ MSG_FORMAT="%(now)s\t%(count)s\t%(category)s\t%(name)s\t%(data)s\n" LOG_PATH = '/var/log/ansible' def getlogin(): - return pwd.getpwuid(os.geteuid())[0] + try: + user = os.getlogin() + except OSError, e: + user = pwd.getpwuid(os.geteuid())[0] + return user class LogMech(object): def __init__(self): |