From d7d6f4555803627cfec5fe04359805adf183d5a6 Mon Sep 17 00:00:00 2001 From: twangboy Date: Tue, 12 Jan 2016 14:32:14 -0700 Subject: [PATCH] Added logic for os x in the user state --- salt/states/user.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/salt/states/user.py b/salt/states/user.py index 4fefd9b48e..57f4531451 100644 --- a/salt/states/user.py +++ b/salt/states/user.py @@ -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