#NEWLINE# def _set_account_policy( name , policy ) : #NEWLINE# #INDENT# '\n    Set a value in the user accountPolicy. For use by this module only\n\n    :param str name: The user name\n    :param str policy: The policy to apply\n\n    :return: True if success, otherwise False\n    :rtype: bool\n\n    :raises: CommandExecutionError on user not found or any other unknown error\n    ' #NEWLINE# cmd = 'pwpolicy -u {0} -setpolicy "{1}"' . format ( name , policy ) #NEWLINE# try : #NEWLINE# #INDENT# return salt . utils . mac_utils . execute_return_success ( cmd ) #NEWLINE# #UNINDENT# except CommandExecutionError as exc : #NEWLINE# #INDENT# if ( 'Error: user <{0}> not found' . format ( name ) in exc . strerror ) : #NEWLINE# #INDENT# raise CommandExecutionError ( 'User not found: {0}' . format ( name ) ) #NEWLINE# #UNINDENT# raise CommandExecutionError ( 'Unknown error: {0}' . format ( exc . strerror ) )