mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Implement password aging info for all BSDs.
This commit is contained in:
parent
c40cdcf803
commit
0049a64d7a
@ -50,10 +50,14 @@ def info(name):
|
||||
'name': '',
|
||||
'passwd': ''}
|
||||
|
||||
# Get password aging info on FreeBSD
|
||||
# TODO: Implement this for NetBSD, OpenBSD
|
||||
cmd = ""
|
||||
if __salt__['cmd.has_exec']('pw'):
|
||||
cmd = 'pw user show {0} | cut -f6,7 -d:'.format(name)
|
||||
cmd = 'pw user show {0}'.format(name)
|
||||
elif __grains__['kernel'] in ('NetBSD', 'OpenBSD'):
|
||||
cmd = 'grep "^{0}:" /etc/master.passwd'.format(name)
|
||||
|
||||
if cmd:
|
||||
cmd += '| cut -f6,7 -d:'
|
||||
try:
|
||||
change, expire = __salt__['cmd.run_all'](cmd)['stdout'].split(':')
|
||||
except ValueError:
|
||||
|
Loading…
Reference in New Issue
Block a user