Added logic for os x in the user state

This commit is contained in:
twangboy 2016-01-12 14:32:14 -07:00
parent ac008bf22d
commit d7d6f45558

View File

@ -615,7 +615,9 @@ def present(name,
if not createhome:
# pwd incorrectly reports presence of home
ret['changes']['home'] = ''
if 'shadow.info' in __salt__ and not salt.utils.is_windows():
if 'shadow.info' in __salt__ \
and not salt.utils.is_windows()\
and not salt.utils.is_darwin():
if password and not empty_password:
__salt__['shadow.set_password'](name, password)
spost = __salt__['shadow.info'](name)
@ -686,6 +688,13 @@ def present(name,
' {1}'.format(name, 'XXX-REDACTED-XXX')
ret['result'] = False
ret['changes']['passwd'] = 'XXX-REDACTED-XXX'
elif salt.utils.is_darwin() and password and not empty_password:
if not __salt__['shadow.set_password'](name, password):
ret['comment'] = 'User {0} created but failed to set' \
' password to' \
' {1}'.format(name, 'XXX-REDACTED-XXX')
ret['result'] = False
ret['changes']['passwd'] = 'XXX-REDACTED-XXX'
else:
ret['comment'] = 'Failed to create new user {0}'.format(name)
ret['result'] = False