Merge pull request #9128 from msabramo/expose_more_user_facts

Expose more facts about user on host system
This commit is contained in:
Brian Coca 2015-01-29 09:55:30 -05:00
commit e4a7b973fd

View file

@ -29,6 +29,7 @@ import socket
import struct import struct
import datetime import datetime
import getpass import getpass
import pwd
import ConfigParser import ConfigParser
import StringIO import StringIO
@ -551,6 +552,12 @@ class Facts(object):
# User # User
def get_user_facts(self): def get_user_facts(self):
self.facts['user_id'] = getpass.getuser() self.facts['user_id'] = getpass.getuser()
pwent = pwd.getpwnam(getpass.getuser())
self.facts['user_uid'] = pwent.pw_uid
self.facts['user_gid'] = pwent.pw_gid
self.facts['user_gecos'] = pwent.pw_gecos
self.facts['user_dir'] = pwent.pw_dir
self.facts['user_shell'] = pwent.pw_shell
def get_env_facts(self): def get_env_facts(self):
self.facts['env'] = {} self.facts['env'] = {}