summaryrefslogtreecommitdiffstats
path: root/callback_plugins
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2013-07-04 15:23:16 -0400
committerSeth Vidal <skvidal@fedoraproject.org>2013-07-04 15:23:16 -0400
commit272a6b10b55d61e65fa28bf1ee84d217913d317c (patch)
tree0567e0c3c0a93c70b898221b91ec2c69a451f4c1 /callback_plugins
parent4ea5bc2a425d85d90f36c4318949f7c64f6fcd73 (diff)
downloadansible-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.py6
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):