Return whether the user exists based on rabbitmqctl list_users.

    CLI Example:

    .. code-block:: bash

        salt '*' rabbitmq.user_exists rabbit_user
516537
def user_exists(name, runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    return name in list_users(runas=runas)
1178923
def exists(project, credentials):
        """"""
        user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable
        printdebug("Checking if project " + project + " exists for " + user)
        return os.path.isdir(Project.path(project, user))
1282515
function userExists(user) {
  if (_.isEmpty(findUser(user, {refresh: true, throwIfNotFound: false}))) {
    return false;
  } else {
    return true;
  }
}
711694
def list_permissions(vhost, runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'list_permissions', '-q', '-p', vhost],
        reset_system_locale=False,
        runas=runas,
        python_shell=False)

    return _output_to_dict(res)
481629
def user_exists_p(login, connector):
    
    url = '/users/' + login + '/'
    _r = connector.get(url)
    return (_r.status_code == Constants.PULP_GET_OK)
189039
def get_user(self, name):
        
        try:
            return self._user_manager.get(name)
        except exc.NotFound:
            raise exc.NoSuchDatabaseUser("No user by the name '%s' exists." %
                    name)
79368
def exists(self, **kwargs):
        

        if LooseVersion(self.tmos_ver) == LooseVersion('11.6.0'):
            return self._exists_11_6(**kwargs)
        else:
            return super(Network, self)._exists(**kwargs)
976801
def list_users(self):
        
        lines = output_lines(self.exec_psql('\\du'))
        return [line.split('|') for line in lines]
978781
def exists(self):
        
        try:
            queue = self.queue
            queue.queue_declare(passive=True)
        except NotFound:
            return False
        except ChannelError as e:
            if e.reply_code == '404':
                return False
            raise e
        return True
975896
def user_absent(name):
    '''
    
    '''

    ret = {'name': name,
           'result': False,
           'changes': {},
           'comment': ''}

    old_user = __salt__['onyx.cmd']('get_user', username=name)

    if not old_user:
        ret['result'] = True
        ret['comment'] = 'User does not exist'
        return ret

    if __opts__['test'] is True and old_user:
        ret['result'] = None
        ret['comment'] = 'User will be removed'
        ret['changes']['old'] = old_user
        ret['changes']['new'] = ''
        return ret

    __salt__['onyx.cmd']('remove_user', username=name)

    if __salt__['onyx.cmd']('get_user', username=name):
        ret['comment'] = 'Failed to remove user'
    else:
        ret['result'] = True
        ret['comment'] = 'User removed'
        ret['changes']['old'] = old_user
        ret['changes']['new'] = ''
    return ret
12937
def user_exists(name,
                user=None, host=None, port=None, maintenance_db=None,
                password=None,
                runas=None):
    '''
    
    '''
    return bool(
        role_get(name,
                 user=user,
                 host=host,
                 port=port,
                 maintenance_db=maintenance_db,
                 password=password,
                 runas=runas,
                 return_password=False))
1279470
def list_users(self):
        
        lines = output_lines(self.exec_rabbitmqctl_list('users'))
        return [_parse_rabbitmq_user(line) for line in lines]
522198
def user_exists(self,
	                user,
	                note=None,
	                loglevel=logging.DEBUG):
		
		shutit = self.shutit
		shutit.handle_note(note)
		exists = False
		if user == '':
			return exists
		#                v the space is intentional, to avoid polluting bash history.
		# The quotes before XIST are deliberate, to prevent the command from matching the expect.
		ret = self.send(ShutItSendSpec(self,
		                               send=' command id %s && echo E""XIST || echo N""XIST' % user,
		                               expect=['NXIST', 'EXIST'],
		                               echo=False,
		                               loglevel=loglevel,
		                               ignore_background=True))
		if ret:
			exists = True
		# sync with the prompt
		self.expect(self.default_expect)
		shutit.handle_note_after(note=note)
		return exists
44082
def check_password(name, password, runas=None):
    '''
    
    '''
    # try to get the rabbitmq-version - adapted from _get_rabbitmq_plugin

    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()

    try:
        res = __salt__['cmd.run']([RABBITMQCTL, 'status'], reset_system_locale=False, runas=runas, python_shell=False)
        server_version = re.search(r'\{rabbit,"RabbitMQ","(.+)"\}', res)

        if server_version is None:
            raise ValueError

        server_version = server_version.group(1).split('-')[0]
        version = [int(i) for i in server_version.split('.')]
    except ValueError:
        version = (0, 0, 0)
    if len(version) < 3:
        version = (0, 0, 0)

    # rabbitmq introduced a native api to check a username and password in version 3.5.7.
    if tuple(version) >= (3, 5, 7):
        if salt.utils.platform.is_windows():
            # On Windows, if the password contains a special character
            # such as '|', normal execution will fail. For example:
            # cmd: rabbitmq.add_user abc "asdf|def"
            # stderr: 'def' is not recognized as an internal or external
            #         command,\r\noperable program or batch file.
            # Work around this by using a shell and a quoted command.
            python_shell = True
            cmd = '"{0}" authenticate_user "{1}" "{2}"'.format(
                RABBITMQCTL, name, password
            )
        else:
            python_shell = False
            cmd = [RABBITMQCTL, 'authenticate_user', name, password]

        res = __salt__['cmd.run_all'](
            cmd,
            reset_system_locale=False,
            runas=runas,
            output_loglevel='quiet',
            python_shell=python_shell)

        if res['retcode'] != 0 or res['stderr']:
            return False
        return True

    cmd = ('rabbit_auth_backend_internal:check_user_login'
        '(<<"{0}">>, [{{password, <<"{1}">>}}]).').format(
        name.replace('"', '\\"'),
        password.replace('"', '\\"'))

    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'eval', cmd],
        reset_system_locale=False,
        runas=runas,
        output_loglevel='quiet',
        python_shell=False)
    msg = 'password-check'

    _response = _format_response(res, msg)
    _key = _response.keys()[0]

    if 'invalid credentials' in _response[_key]:
        return False

    return True
26175
def queue_exists(self, queue):
        
        try:
            self.channel.queue_declare(queue=queue, passive=True)
        except AMQPChannelException, e:
            if e.amqp_reply_code == 404:
                return False
            raise e
        else:
            return True
244018
def User(self, Username=''):
        
        if not Username:
            Username = self.CurrentUserHandle
        o = User(self, Username)
        o.OnlineStatus # Test if such a user exists.
        return o
852659
def absent(name,
           vhost='/',
           runas=None):
    '''
    
    '''
    ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}

    policy_exists = __salt__['rabbitmq.policy_exists'](
        vhost, name, runas=runas)

    if not policy_exists:
        ret['comment'] = 'Policy \'{0} {1}\' is not present.'.format(vhost, name)
        return ret

    if not __opts__['test']:
        result = __salt__['rabbitmq.delete_policy'](vhost, name, runas=runas)
        if 'Error' in result:
            ret['result'] = False
            ret['comment'] = result['Error']
            return ret
        elif 'Deleted' in result:
            ret['comment'] = 'Deleted'

    # If we've reached this far before returning, we have changes.
    ret['changes'] = {'new': '', 'old': name}

    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Policy \'{0} {1}\' will be removed.'.format(vhost, name)

    return ret