Check a pool member exists in a specific pool
978162
def check_member_pool(self, member, pool_name):
        '''
        
        '''
        members = self.bigIP.LocalLB.Pool.get_member(pool_names=[pool_name])[0]
        for mem in members:
            if member == mem.address:
                return True
        return False
1073957
def update_lbaas_member(self, lbaas_member, lbaas_pool, body=None):
        """"""
        return self.put(self.lbaas_member_path % (lbaas_pool, lbaas_member),
                        body=body)
78348
def exists(self):
        """"""

        try:
            self.s3_object.load()
            return True
        except botocore.exceptions.ClientError: return False
1001651
def instance_contains(container, item):
    """"""
    return item in (member for _, member in inspect.getmembers(container))
60271
def exists(self, callback=None):
        
        def existence_tested(response):
            if callable(callback):
                callback(bool(response))
        self.bucket.lookup(self.name, callback=existence_tested)
1229206
def _check_existence_by_collection(self, container, item_name):
        '''
        '''

        coll = container.get_collection()
        for item in coll:
            if item.name == item_name:
                return True
        return False
347315
def check_member(m)
      potential_members = self.class::MEMBER_CLASS.map_all_ids_to(:name, api: @api)
      if m.to_s =~ /^\d+$/
        return { id: m.to_i, name: potential_members[m] } if potential_members.key?(m.to_i)
      else
        return { name: m, id: potential_members.invert[m] } if potential_members.value?(m)
      end
      raise JSS::NoSuchItemError, "No #{self.class::MEMBER_CLASS::RSRC_OBJECT_KEY} matching '#{m}' in the JSS."
    end
929590
def exists(self, qname):
        '''
        
        '''
        try:
            # First if not exists() -> exit
            if self.conn.queue_exists(qname):
                return True
            return False
        except pyrax.exceptions as err_msg:
            log.error('RackSpace API got some problems during '
                      'existing queue check: %s',
                      err_msg)
        return False
24813
def _find_set_members(set):
    '''
    
    '''

    cmd = '{0} list {1}'.format(_ipset_cmd(), set)
    out = __salt__['cmd.run_all'](cmd, python_shell=False)

    if out['retcode'] > 0:
        # Set doesn't exist return false
        return False

    _tmp = out['stdout'].split('\n')
    members = []
    startMembers = False
    for i in _tmp:
        if startMembers:
            members.append(i)
        if 'Members:' in i:
            startMembers = True
    return members
1165441
def get_member(self, jid, default=None):
        """"""
        member = filter(lambda m: m['JID'] == jid, self.params['MEMBERS'])
        if len(member) == 1:
            return member[0]
        elif len(member) == 0:
            return default
        else:
            raise Exception('Multple members have the same JID of [%s]' % (jid,))
253195
def exists(cls, id):
        """"""
        return bool(redisco.get_client().exists(cls._key[str(id)]) or
                    redisco.get_client().sismember(cls._key['all'], str(id)))
1177455
def _incr_exceptions(self):
        """"""
        self._pool_manager.get_connection(self.pid, self._conn).exceptions += 1
1200742
def check_member_state(self):
        """"""
        bad_states = (0, 3, 4, 5, 6, 9)
        try:
            rs_status = self.run_command('replSetGetStatus')
            bad_members = [member for member in rs_status['members']
                           if member['state'] in bad_states]
            if bad_members:
                return False
        except pymongo.errors.AutoReconnect:
            # catch 'No replica set primary available' Exception
            return False
        logger.debug("all members in correct state")
        return True
1208067
def fetch_pool(repo_url, branch='master', reuse_existing=False):
    """"""
    repo_name = get_repo_name(repo_url)
    lib_dir = get_lib_dir()
    pool_dir = get_pool_dir(repo_name)
    print('... fetching %s ' % repo_name)

    if os.path.exists(pool_dir):
        if not reuse_existing:
            raise Exception('ERROR: repository already exists')
    else:
        try:
            a = call(['git', 'clone', repo_url], cwd=lib_dir)
        except OSError:
            raise Exception('ERROR: You probably dont have git installed: sudo apt-get install git')

        if a != 0:
            raise Exception('ERROR: check your repository url and credentials!')

    try:
        call(['git', 'checkout', branch], cwd=pool_dir)
    except OSError:
        raise Exception('ERROR: cannot switch branches')

    print('... repository successfully cloned')
    return FeaturePool(pool_dir)
1316260
def check_member_pool(lb, member, pool_name):
    '''
    
    '''
    if __opts__['load_balancers'].get(lb, None):
        (username, password) = list(__opts__['load_balancers'][lb].values())
    else:
        raise Exception('Unable to find `{0}` load balancer'.format(lb))
    F5 = F5Mgmt(lb, username, password)
    return F5.check_member_pool(member, pool_name)
502421
def show_lbaas_pool(self, lbaas_pool, **_params):
        """"""
        return self.get(self.lbaas_pool_path % (lbaas_pool),
                        params=_params)
485524
def check_existence(to_check, name, config_key=None, relative_to=None,
                    allow_undefined=False, allow_not_existing=False,
                    base_key='releaser'):
    """"""
    if allow_undefined and (to_check is None or to_check.lower() == 'none'):
        print("{: <14} -> {}UNDEFINED{}".format(name, WARNING_COLOR,
                                                RESET_COLOR))
        return
    else:
        if config_key is None:
            config_key = "{}.{}".format(base_key, name)
        my_check = Path(to_check).resolve()
        if my_check.exists() and relative_to is not None:
            printed_path = str(my_check.relative_to(relative_to))
            if printed_path != '.':
                printed_path = '.' + os.sep + printed_path
        else:
            printed_path = str(my_check)
        if my_check.exists() or allow_not_existing:
            print("{: <14} -> {}".format(name, printed_path))
            return
        else:
            raise FileNotFoundError("[{}ERROR{}] '{}', as given, doesn't "
                                    "exist. For configuration key '{}', was "
                                    "given: {}".format(ERROR_COLOR, RESET_COLOR,
                                                       name, config_key,
                                                       to_check))