Returns minion configurations dict.
508058
def apply_minion_config(overrides=None,
                        defaults=None,
                        cache_minion_id=False,
                        minion_id=None):
    '''
    
    '''
    if defaults is None:
        defaults = DEFAULT_MINION_OPTS.copy()
    if overrides is None:
        overrides = {}

    opts = defaults.copy()
    opts['__role'] = 'minion'
    _adjust_log_file_override(overrides, defaults['log_file'])
    if overrides:
        opts.update(overrides)

    if 'environment' in opts:
        if opts['saltenv'] is not None:
            log.warning(
                'The \'saltenv\' and \'environment\' minion config options '
                'cannot both be used. Ignoring \'environment\' in favor of '
                '\'saltenv\'.',
            )
            # Set environment to saltenv in case someone's custom module is
            # refrencing __opts__['environment']
            opts['environment'] = opts['saltenv']
        else:
            log.warning(
                'The \'environment\' minion config option has been renamed '
                'to \'saltenv\'. Using %s as the \'saltenv\' config value.',
                opts['environment']
            )
            opts['saltenv'] = opts['environment']

    for idx, val in enumerate(opts['fileserver_backend']):
        if val in ('git', 'hg', 'svn', 'minion'):
            new_val = val + 'fs'
            log.debug(
                'Changed %s to %s in minion opts\' fileserver_backend list',
                val, new_val
            )
            opts['fileserver_backend'][idx] = new_val

    opts['__cli'] = salt.utils.stringutils.to_unicode(
        os.path.basename(sys.argv[0])
    )

    # No ID provided. Will getfqdn save us?
    using_ip_for_id = False
    if not opts.get('id'):
        if minion_id:
            opts['id'] = minion_id
        else:
            opts['id'], using_ip_for_id = get_id(
                    opts,
                    cache_minion_id=cache_minion_id)

    # it does not make sense to append a domain to an IP based id
    if not using_ip_for_id and 'append_domain' in opts:
        opts['id'] = _append_domain(opts)

    for directory in opts.get('append_minionid_config_dirs', []):
        if directory in ('pki_dir', 'cachedir', 'extension_modules'):
            newdirectory = os.path.join(opts[directory], opts['id'])
            opts[directory] = newdirectory
        elif directory == 'default_include' and directory in opts:
            include_dir = os.path.dirname(opts[directory])
            new_include_dir = os.path.join(include_dir,
                                           opts['id'],
                                           os.path.basename(opts[directory]))
            opts[directory] = new_include_dir

    # pidfile can be in the list of append_minionid_config_dirs, but pidfile
    # is the actual path with the filename, not a directory.
    if 'pidfile' in opts.get('append_minionid_config_dirs', []):
        newpath_list = os.path.split(opts['pidfile'])
        opts['pidfile'] = os.path.join(newpath_list[0], 'salt', opts['id'], newpath_list[1])

    if len(opts['sock_dir']) > len(opts['cachedir']) + 10:
        opts['sock_dir'] = os.path.join(opts['cachedir'], '.salt-unix')

    # Enabling open mode requires that the value be set to True, and
    # nothing else!
    opts['open_mode'] = opts['open_mode'] is True
    opts['file_roots'] = _validate_file_roots(opts['file_roots'])
    opts['pillar_roots'] = _validate_pillar_roots(opts['pillar_roots'])
    # Make sure ext_mods gets set if it is an untrue value
    # (here to catch older bad configs)
    opts['extension_modules'] = (
        opts.get('extension_modules') or
        os.path.join(opts['cachedir'], 'extmods')
    )
    # Set up the utils_dirs location from the extension_modules location
    opts['utils_dirs'] = (
        opts.get('utils_dirs') or
        [os.path.join(opts['extension_modules'], 'utils')]
    )

    # Insert all 'utils_dirs' directories to the system path
    insert_system_path(opts, opts['utils_dirs'])

    # Prepend root_dir to other paths
    prepend_root_dirs = [
        'pki_dir', 'cachedir', 'sock_dir', 'extension_modules', 'pidfile',
    ]

    # These can be set to syslog, so, not actual paths on the system
    for config_key in ('log_file', 'key_logfile'):
        if urlparse(opts.get(config_key, '')).scheme == '':
            prepend_root_dirs.append(config_key)

    prepend_root_dir(opts, prepend_root_dirs)

    # if there is no beacons option yet, add an empty beacons dict
    if 'beacons' not in opts:
        opts['beacons'] = {}

    if overrides.get('ipc_write_buffer', '') == 'dynamic':
        opts['ipc_write_buffer'] = _DFLT_IPC_WBUFFER

    # Make sure hash_type is lowercase
    opts['hash_type'] = opts['hash_type'].lower()

    # Check and update TLS/SSL configuration
    _update_ssl_config(opts)
    _update_discovery_config(opts)

    return opts
471095
def get_configs(self):
        
        loadout_config = self.loadout_preset.config.copy()

        config_path = None
        if self.agent_preset.config_path is not None:  # Might be none if preset was never saved to disk.
            config_path = os.path.dirname(self.agent_preset.config_path)
        config = self.agent_preset.config.copy()
        config.set_value(BOT_CONFIG_MODULE_HEADER, BOT_NAME_KEY, self.ingame_name)
        config_bundle = BotConfigBundle(config_path, config, os.path.basename(self.agent_preset.config_path))

        return self.overall_index, config_bundle, loadout_config
140173
def _ret_minions(self, filter_):
        '''
        
        '''
        minions = {}
        for minion in filter_(self.raw):
            data = self.get_data(minion)
            if data:
                minions[minion] = data.copy()
        return minions
320871
def generate_minion_id():
    '''
    
    '''
    try:
        ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first())
    except TypeError:
        ret = None
    return ret or 'localhost'
927515
def ret_range_minions(self):
        '''
        
        '''
        if HAS_RANGE is False:
            raise RuntimeError("Python lib 'seco.range' is not available")

        minions = {}
        range_hosts = _convert_range_to_list(self.tgt, __opts__['range_server'])
        return self._ret_minions(range_hosts.__contains__)
75941
def _get_config():
    '''
    
    '''
    cfg = os.path.expanduser('~/.dockercfg')
    try:
        fic = open(cfg)
        try:
            config = json.loads(fic.read())
        finally:
            fic.close()
    except Exception:
        config = {'rootPath': '/dev/null'}
    if not 'Configs' in config:
        config['Configs'] = {}
    return config
674059
def configuration(self):
        ''''''
        with self._mutex:
            if not self._configuration:
                self._configuration = utils.nvlist_to_dict(self._obj.get_configuration())
        return self._configuration
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
667948
def store_minions(opts, jid, minions, mminion=None, syndic_id=None):
    '''
    
    '''
    if mminion is None:
        mminion = salt.minion.MasterMinion(opts, states=False, rend=False)
    job_cache = opts['master_job_cache']
    minions_fstr = '{0}.save_minions'.format(job_cache)

    try:
        mminion.returners[minions_fstr](jid, minions, syndic_id=syndic_id)
    except KeyError:
        raise KeyError(
            'Returner \'{0}\' does not support function save_minions'.format(
                job_cache
            )
        )
1101736
def get_data(self, minion):
        '''
        
        '''
        ret = copy.deepcopy(__opts__.get('roster_defaults', {}))
        if isinstance(self.raw[minion], six.string_types):
            ret.update({'host': self.raw[minion]})
            return ret
        elif isinstance(self.raw[minion], dict):
            ret.update(self.raw[minion])
            return ret
        return False
109686
def get_default_config(self):
        
        config = super(PuppetDBCollector, self).get_default_config()
        config.update({
            'host': 'localhost',
            'port': 8080,
            'path': 'PuppetDB',
        })
        return config
727164
def get_fun(fun):
    '''
    
    '''
    serv = _get_serv(ret=None)
    ret = {}
    for minion in serv.smembers('minions'):
        ind_str = '{0}:{1}'.format(minion, fun)
        try:
            jid = serv.get(ind_str)
        except Exception:
            continue
        if not jid:
            continue
        data = serv.get('{0}:{1}'.format(minion, jid))
        if data:
            ret[minion] = salt.utils.json.loads(data)
    return ret
433667
def _create_minion_object(self, opts, timeout, safe,
                              io_loop=None, loaded_base_name=None,
                              jid_queue=None):
        '''
        
        '''
        return Minion(opts,
                      timeout,
                      safe,
                      io_loop=io_loop,
                      loaded_base_name=loaded_base_name,
                      jid_queue=jid_queue)
250135
def _all_minions(self, expr=None):
        '''
        
        '''
        mlist = []
        for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(os.path.join(self.opts['pki_dir'], self.acc))):
            if not fn_.startswith('.') and os.path.isfile(os.path.join(self.opts['pki_dir'], self.acc, fn_)):
                mlist.append(fn_)
        return {'minions': mlist, 'missing': []}
374393
def getConfig(self):
        
        return {'graph': self._graphAttrDict,
                'fields': [(field_name, self._fieldAttrDict.get(field_name))
                           for field_name in self._fieldNameList]}
1065969
def to_dict(self):
        ''''''
        d = {'id': self.id}
        data = []
        for c in self._config_data:
            data.append(c.to_dict())
        if data:
            d['configurationData'] = data
        return d
736808
def get_configuration_dict(self, secret_attrs=False):
        """"""
        cd = {'repo_nexml2json': self.repo_nexml2json,
              'number_of_shards': len(self._shards),
              'initialization': self._filepath_args,
              'shards': [],
              }
        for i in self._shards:
            cd['shards'].append(i.get_configuration_dict(secret_attrs=secret_attrs))
        return cd