def set_password(name, password):
 cmd = "dscl . -passwd /Users/{0} '{1}'".format(name, password)
 try:
  salt.utils.mac_utils.execute_return_success(cmd)
 except CommandExecutionError as exc:
  if ('eDSUnknownNodeName' in exc.strerror):
   raise CommandExecutionError('User not found: {0}'.format(name))
  raise CommandExecutionError('Unknown error: {0}'.format(exc.strerror))
 return True

def set_password ( name , password ) : cmd = "dscl . -passwd /Users/{0} '{1}'" . format ( name , password ) try : salt . utils . mac_utils . execute_return_success ( cmd ) except CommandExecutionError as exc : if ( 'eDSUnknownNodeName' in exc . strerror ) : raise CommandExecutionError ( 'User not found: {0}' . format ( name ) ) raise CommandExecutionError ( 'Unknown error: {0}' . format ( exc . strerror ) ) return True
set the password for a named user .