Return the minions found by looking via pillar
768911
def _check_pillar_exact_minions(self, expr, delimiter, greedy):
        '''
        
        '''
        return self._check_cache_minions(expr,
                                         delimiter,
                                         greedy,
                                         'pillar',
                                         exact_match=True)
1026858
def mine_get(tgt, fun, tgt_type='glob', opts=None):
    '''
    
    '''
    ret = {}
    serial = salt.payload.Serial(opts)
    checker = CkMinions(opts)
    _res = checker.check_minions(
            tgt,
            tgt_type)
    minions = _res['minions']
    cache = salt.cache.factory(opts)

    if isinstance(fun, six.string_types):
        functions = list(set(fun.split(',')))
        _ret_dict = len(functions) > 1
    elif isinstance(fun, list):
        functions = fun
        _ret_dict = True
    else:
        return {}

    for minion in minions:
        mdata = cache.fetch('minions/{0}'.format(minion), 'mine')

        if not isinstance(mdata, dict):
            continue

        if not _ret_dict and functions and functions[0] in mdata:
            ret[minion] = mdata.get(functions)
        elif _ret_dict:
            for fun in functions:
                if fun in mdata:
                    ret.setdefault(fun, {})[minion] = mdata.get(fun)

    return ret
1332519
def _check_minions_directories(pki_dir):
    '''
    
    '''
    minions_accepted = os.path.join(pki_dir, salt.key.Key.ACC)
    minions_pre = os.path.join(pki_dir, salt.key.Key.PEND)
    minions_rejected = os.path.join(pki_dir, salt.key.Key.REJ)
    minions_denied = os.path.join(pki_dir, salt.key.Key.DEN)

    return minions_accepted, minions_pre, minions_rejected, minions_denied
308927
def get_minions():
    '''
    
    '''
    log.debug('sdstack_etcd returner <get_minions> called')
    ret = []
    client, path = _get_conn(__opts__)
    items = client.get('/'.join((path, 'minions')))
    for item in items.children:
        comps = str(item.key).split('/')
        ret.append(comps[-1])
    return ret
796174
def ext_pillar(minion_id,  # pylint: disable=W0613
               pillar,  # pylint: disable=W0613
               command):
    '''
    
    '''
    try:
        command = command.replace('%s', minion_id)
        output = __salt__['cmd.run_stdout'](command, python_shell=True)
        return salt.utils.yaml.safe_load(output)
    except Exception:
        log.critical(
            'YAML data from \'%s\' failed to parse. Command output:\n%s',
            command, output
        )
        return {}
731150
def get(tgt, fun, tgt_type='glob'):
    '''
    
    '''
    ret = salt.utils.minions.mine_get(tgt, fun, tgt_type, __opts__)
    return ret
1097491
def list_roots():
    '''
    
    '''
    ret = {}
    for saltenv in __opts__['pillar_roots']:
        ret[saltenv] = []
        ret[saltenv].append(list_env(saltenv))
    return ret
942785
def get_minions():
    '''
    
    '''
    options = _get_options(ret=None)

    # Make sure the views are valid, which includes the minions..
    if not ensure_views():
        return []

    # Make the request for the view..
    _response = _request("GET",
                         options['url'] +
                                 options['db'] +
                                 "/_design/salt/_view/minions?group=true")

    # Verify that we got a response back.
    if 'rows' not in _response:
        log.error('Unable to get available minions: %s', _response)
        return []

    # Iterate over the rows to build up a list return it.
    _ret = []
    for row in _response['rows']:
        _ret.append(row['key'])
    return _ret
275572
def ext_pillar(minion_id, pillar, repo, branch='default', root=None):
    '''
    
    '''
    with Repo(repo) as repo:
        repo.update(branch)
    envname = 'base' if branch == 'default' else branch
    if root:
        path = os.path.normpath(os.path.join(repo.working_dir, root))
    else:
        path = repo.working_dir

    opts = copy.deepcopy(__opts__)
    opts['pillar_roots'][envname] = [path]
    pil = salt.pillar.Pillar(opts, __grains__, minion_id, envname)
    return pil.compile_pillar(ext=False)
1127890
def _check_grain_minions(self, expr, delimiter, greedy):
        '''
        
        '''
        return self._check_cache_minions(expr, delimiter, greedy, 'grains')
1108014
def item(*args):
    '''
    
    '''
    ret = {}
    for arg in args:
        try:
            ret[arg] = __pillar__[arg]
        except KeyError:
            pass
    return ret
726528
def get_fun(fun):
    '''
    
    '''

    # Get the options..
    options = _get_options(ret=None)

    # Define a simple return object.
    _ret = {}

    # get_minions takes care of calling ensure_views for us. For each minion we know about
    for minion in get_minions():

        # Make a query of the by-minion-and-timestamp view and limit the count to 1.
        _response = _request("GET",
                             options['url'] +
                                     options['db'] +
                                     ('/_design/salt/_view/by-minion-fun-times'
                                      'tamp?descending=true&endkey=["{0}","{1}'
                                      '",0]&startkey=["{2}","{3}",9999999999]&'
                                      'limit=1').format(minion,
                                                        fun,
                                                        minion,
                                                        fun))
        # Skip the minion if we got an error..
        if 'error' in _response:
            log.warning('Got an error when querying for last command '
                        'by a minion: %s', _response['error'])
            continue

        # Skip the minion if we didn't get any rows back. ( IE function that
        # they're looking for has a typo in it or some such ).
        if not _response['rows']:
            continue

        # Set the respnse ..
        _ret[minion] = _response['rows'][0]['value']

    return _ret
1173983
def ext_pillar(minion_id,  # pylint: disable=W0613
               pillar,  # pylint: disable=W0613
               conf,
               nesting_key=None):
    '''
    
    '''
    comps = conf.split()

    paths = [comp for comp in comps if comp.startswith('path=')]
    if not paths:
        log.error('"%s" is not a valid Vault ext_pillar config', conf)
        return {}

    vault_pillar = {}

    try:
        path = paths[0].replace('path=', '')
        path = path.format(**{'minion': minion_id})
        url = 'v1/{0}'.format(path)
        response = __utils__['vault.make_request']('GET', url)
        if response.status_code == 200:
            vault_pillar = response.json().get('data', {})
        else:
            log.info('Vault secret not found for: %s', path)
    except KeyError:
        log.error('No such path in Vault: %s', path)

    if nesting_key:
        vault_pillar = {nesting_key: vault_pillar}
    return vault_pillar
466071
def pillars(opts, functions, context=None):
    '''
    
    '''
    ret = LazyLoader(_module_dirs(opts, 'pillar'),
                     opts,
                     tag='pillar',
                     pack={'__salt__': functions,
                           '__context__': context,
                           '__utils__': utils(opts)})
    ret.pack['__ext_pillar__'] = ret
    return FilterDictWrapper(ret, '.ext_pillar')
450704
def ext_pillar(minion_id,  # pylint: disable=W0613
               pillar,  # pylint: disable=W0613
               command):
    '''
    
    '''
    try:
        command = command.replace('%s', minion_id)
        return salt.utils.json.loads(__salt__['cmd.run'](command))
    except Exception:
        log.critical('JSON data from %s failed to parse', command)
        return {}
697329
def ext_pillar(minion_id,
               pillar,
               *args,
               **kwargs):
    '''
    
    '''
    return POSTGRESExtPillar().fetch(minion_id, pillar, *args, **kwargs)
1009389
def ret_glob_minions(self):
        '''
        
        '''
        fnfilter = functools.partial(fnmatch.filter, pat=self.tgt)
        return self._ret_minions(fnfilter)