def _mine_get(self, load, skip_verify=False):
        '''
        Gathers the data from the specified minions' mine
        '''
        if not skip_verify:
            if any(key not in load for key in ('id', 'tgt', 'fun')):
                return {}

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

        functions_allowed = []

        if 'mine_get' in self.opts:
            # If master side acl defined.
            if not isinstance(self.opts['mine_get'], dict):
                return {}
            perms = set()
            for match in self.opts['mine_get']:
                if re.match(match, load['id']):
                    if isinstance(self.opts['mine_get'][match], list):
                        perms.update(self.opts['mine_get'][match])

            for fun in functions:
                if any(re.match(perm, fun) for perm in perms):
                    functions_allowed.append(fun)

            if not functions_allowed:
                return {}
        else:
            functions_allowed = functions

        ret = {}
        if not salt.utils.verify.valid_id(self.opts, load['id']):
            return ret
        expr_form = load.get('expr_form')
        if expr_form is not None and 'tgt_type' not in load:
            salt.utils.versions.warn_until(
                'Neon',
                '_mine_get: minion {0} uses pre-Nitrogen API key '
                '"expr_form". Accepting for backwards compatibility '
                'but this is not guaranteed '
                'after the Neon release'.format(load['id'])
            )
            match_type = expr_form
        else:
            match_type = load.get('tgt_type', 'glob')
        if match_type.lower() == 'pillar':
            match_type = 'pillar_exact'
        if match_type.lower() == 'compound':
            match_type = 'compound_pillar_exact'
        checker = salt.utils.minions.CkMinions(self.opts)
        _res = checker.check_minions(
                load['tgt'],
                match_type,
                greedy=False
                )
        minions = _res['minions']
        for minion in minions:
            fdata = self.cache.fetch('minions/{0}'.format(minion), 'mine')

            if not isinstance(fdata, dict):
                continue

            if not _ret_dict and functions_allowed and functions_allowed[0] in fdata:
                ret[minion] = fdata.get(functions_allowed[0])
            elif _ret_dict:
                for fun in list(set(functions_allowed) & set(fdata.keys())):
                    ret.setdefault(fun, {})[minion] = fdata.get(fun)

        return ret
def _mine_get ( self , load , skip_verify = False ) : if not skip_verify : if any ( key not in load for key in ( 'id' , 'tgt' , 'fun' ) ) : return { } if isinstance ( load [ 'fun' ] , six . string_types ) : functions = list ( set ( load [ 'fun' ] . split ( ',' ) ) ) _ret_dict = len ( functions ) > 1 elif isinstance ( load [ 'fun' ] , list ) : functions = load [ 'fun' ] _ret_dict = True else : return { } functions_allowed = [ ] if 'mine_get' in self . opts : if not isinstance ( self . opts [ 'mine_get' ] , dict ) : return { } perms = set ( ) for match in self . opts [ 'mine_get' ] : if re . match ( match , load [ 'id' ] ) : if isinstance ( self . opts [ 'mine_get' ] [ match ] , list ) : perms . update ( self . opts [ 'mine_get' ] [ match ] ) for fun in functions : if any ( re . match ( perm , fun ) for perm in perms ) : functions_allowed . append ( fun ) if not functions_allowed : return { } else : functions_allowed = functions ret = { } if not salt . utils . verify . valid_id ( self . opts , load [ 'id' ] ) : return ret expr_form = load . get ( 'expr_form' ) if expr_form is not None and 'tgt_type' not in load : salt . utils . versions . warn_until ( 'Neon' , '_mine_get: minion {0} uses pre-Nitrogen API key ' '"expr_form". Accepting for backwards compatibility ' 'but this is not guaranteed ' 'after the Neon release' . format ( load [ 'id' ] ) ) match_type = expr_form else : match_type = load . get ( 'tgt_type' , 'glob' ) if match_type . lower ( ) == 'pillar' : match_type = 'pillar_exact' if match_type . lower ( ) == 'compound' : match_type = 'compound_pillar_exact' checker = salt . utils . minions . CkMinions ( self . opts ) _res = checker . check_minions ( load [ 'tgt' ] , match_type , greedy = False ) minions = _res [ 'minions' ] for minion in minions : fdata = self . cache . fetch ( 'minions/{0}' . format ( minion ) , 'mine' ) if not isinstance ( fdata , dict ) : continue if not _ret_dict and functions_allowed and functions_allowed [ 0 ] in fdata : ret [ minion ] = fdata . get ( functions_allowed [ 0 ] ) elif _ret_dict : for fun in list ( set ( functions_allowed ) & set ( fdata . keys ( ) ) ) : ret . setdefault ( fun , { } ) [ minion ] = fdata . get ( fun ) return ret
Gathers the data from the specified minions' mine