Return a dict of CPAN configuration values

    CLI Example:

    .. code-block:: bash

        salt '*' cpan.show_config
487469
def show_config():
    '''
    
    '''
    ret = {}
    cmd = 'cpan -J'
    out = __salt__['cmd.run'](cmd).splitlines()
    for line in out:
        if '=>' not in line:
            # TODO: Some options take up multiple lines, so this doesn't always work
            continue
        comps = line.split('=>')
        key = comps[0].replace("'", '').strip()
        val = comps[1].replace("',", '').replace("'", '').strip()
        ret[key] = val
    return ret
1150912
def config(self):
        

        return dict((optname, getattr(self, optname))
                    for optname, _ in CFG_OPTIONS if hasattr(self, optname))
762385
def __get_config():
    '''
    
    '''
    if 'config' not in globals():
        return None
    cfg = globals().get('config', None)
    if cfg is None:
        return None

    if not isinstance(cfg, dict):
        return None
    return cfg
1140320
def show_config(jail):
    '''
    
    '''
    ret = {}
    if subprocess.call(["jls", "-nq", "-j", jail]) == 0:
        jls = subprocess.check_output(["jls", "-nq", "-j", jail])  # pylint: disable=minimum-python-version
        jailopts = salt.utils.args.shlex_split(salt.utils.stringutils.to_unicode(jls))
        for jailopt in jailopts:
            if '=' not in jailopt:
                ret[jailopt.strip().rstrip(";")] = '1'
            else:
                key = jailopt.split('=')[0].strip()
                value = jailopt.split('=')[-1].strip().strip("\"")
                ret[key] = value
    else:
        for rconf in ('/etc/rc.conf', '/etc/rc.conf.local'):
            if os.access(rconf, os.R_OK):
                with salt.utils.files.fopen(rconf, 'r') as _fp:
                    for line in _fp:
                        line = salt.utils.stringutils.to_unicode(line)
                        if not line.strip():
                            continue
                        if not line.startswith('jail_{0}_'.format(jail)):
                            continue
                        key, value = line.split('=')
                        ret[key.split('_', 2)[2]] = value.split('"')[1]
        for jconf in ('/etc/jail.conf', '/usr/local/etc/jail.conf'):
            if os.access(jconf, os.R_OK):
                with salt.utils.files.fopen(jconf, 'r') as _fp:
                    for line in _fp:
                        line = salt.utils.stringutils.to_unicode(line)
                        line = line.partition('#')[0].strip()
                        if line:
                            if line.split()[-1] == '{':
                                if line.split()[0] != jail and line.split()[0] != '*':
                                    while line.split()[-1] != '}':
                                        line = next(_fp)
                                        line = line.partition('#')[0].strip()
                                else:
                                    continue
                            if line.split()[-1] == '}':
                                continue
                            if '=' not in line:
                                ret[line.strip().rstrip(";")] = '1'
                            else:
                                key = line.split('=')[0].strip()
                                value = line.split('=')[-1].strip().strip(";'\"")
                                ret[key] = value
    return ret
1227996
def show(config_file=False):
    '''
    
    '''
    ret = {}
    if config_file:
        # If the file doesn't exist, return an empty list
        if not os.path.exists(config_file):
            return []

        try:
            with salt.utils.files.fopen(config_file) as fp_:
                for line in fp_:
                    line = salt.utils.stringutils.to_str(line)
                    if not line.startswith('#') and '=' in line:
                        # search if we have some '=' instead of ' = ' separators
                        SPLIT = ' = '
                        if SPLIT not in line:
                            SPLIT = SPLIT.strip()
                        key, value = line.split(SPLIT, 1)
                        key = key.strip()
                        value = value.lstrip()
                        ret[key] = value
        except (OSError, IOError):
            log.error('Could not open sysctl file')
            return None
    else:
        cmd = 'sysctl -a'
        out = __salt__['cmd.run_stdout'](cmd, output_loglevel='trace')
        for line in out.splitlines():
            if not line or ' = ' not in line:
                continue
            comps = line.split(' = ', 1)
            ret[comps[0]] = comps[1]
    return ret
843349
def _config_getter(get_opt,
                   key,
                   value_regex=None,
                   cwd=None,
                   user=None,
                   password=None,
                   ignore_retcode=False,
                   output_encoding=None,
                   **kwargs):
    '''
    
    '''
    kwargs = salt.utils.args.clean_kwargs(**kwargs)
    global_ = kwargs.pop('global', False)
    if kwargs:
        salt.utils.args.invalid_kwargs(kwargs)

    if cwd is None:
        if not global_:
            raise SaltInvocationError(
                '\'cwd\' argument required unless global=True'
            )
    else:
        cwd = _expand_path(cwd, user)

    if get_opt == '--get-regexp':
        if value_regex is not None \
                and not isinstance(value_regex, six.string_types):
            value_regex = six.text_type(value_regex)
    else:
        # Ignore value_regex
        value_regex = None

    command = ['git', 'config']
    command.extend(_which_git_config(global_, cwd, user, password,
                                     output_encoding=output_encoding))
    command.append(get_opt)
    command.append(key)
    if value_regex is not None:
        command.append(value_regex)
    return _git_run(command,
                    cwd=cwd,
                    user=user,
                    password=password,
                    ignore_retcode=ignore_retcode,
                    failhard=False,
                    output_encoding=output_encoding)
926485
def show(config_file=False):
    '''
    
    '''
    cmd = 'sysctl'
    ret = {}
    out = __salt__['cmd.run_stdout'](cmd, output_loglevel='trace')
    for line in out.splitlines():
        if not line or '=' not in line:
            continue
        comps = line.split('=', 1)
        ret[comps[0]] = comps[1]
    return ret
1061875
def _config(name, conf, default=None):
    '''
    
    '''
    try:
        value = conf[name]
    except KeyError:
        value = default
    return salt.utils.data.decode(value, to_str=True)
524494
def _parse_network_settings(opts, current):
    '''
    
    '''
    # Normalize keys
    opts = dict((k.lower(), v) for (k, v) in six.iteritems(opts))
    current = dict((k.lower(), v) for (k, v) in six.iteritems(current))
    result = {}

    valid = _CONFIG_TRUE + _CONFIG_FALSE
    if 'enabled' not in opts:
        try:
            opts['networking'] = current['networking']
            _log_default_network('networking', current['networking'])
        except ValueError:
            _raise_error_network('networking', valid)
    else:
        opts['networking'] = opts['enabled']

    if opts['networking'] in valid:
        if opts['networking'] in _CONFIG_TRUE:
            result['networking'] = 'yes'
        elif opts['networking'] in _CONFIG_FALSE:
            result['networking'] = 'no'
    else:
        _raise_error_network('networking', valid)

    if 'hostname' not in opts:
        try:
            opts['hostname'] = current['hostname']
            _log_default_network('hostname', current['hostname'])
        except ValueError:
            _raise_error_network('hostname', ['server1.example.com'])

    if opts['hostname']:
        result['hostname'] = opts['hostname']
    else:
        _raise_error_network('hostname', ['server1.example.com'])

    if 'search' in opts:
        result['search'] = opts['search']

    return result
650139
def run_show_config(args):
    """"""
    # TODO Proposal: remove the "hidden" configuration. Only show config. If
    # the system needs to be configured, then display information on how to
    # configure the system.
    config = copy.deepcopy(bigchaindb.config)
    del config['CONFIGURED']
    print(json.dumps(config, indent=4, sort_keys=True))
932577
def show_configure(self):
        
        logging.info("Displaying configuration window")
        if self.configWindow is None:
            self.configWindow = ConfigWindow(self)
            self.configWindow.show()
        else:
            self.configWindow.deiconify()
1223209
def configuration_block_core(conf_module, &block)
      return conf_module unless block_given?
      return conf_module.tap(&block) unless block.arity == 0
      conf_module.module_eval(&block)
      conf_module
    end
801393
def get_configure(self,
                      repo=None,
                      name=None,
                      groups=None,
                      main_cfg=False):
        
        constraints = locals()
        del constraints['main_cfg']
        status = (True, None)
        template_dict = {}
        return_str = ''
        if main_cfg:
            vent_cfg = Template(self.vent_config)
            for section in vent_cfg.sections()[1]:
                template_dict[section] = {}
                for vals in vent_cfg.section(section)[1]:
                    template_dict[section][vals[0]] = vals[1]
        else:
            # all possible vent.template options stored in plugin_manifest
            options = ['info', 'service', 'settings', 'docker', 'gpu']
            tools = Template(System().manifest).constrain_opts(
                constraints, options)[0]
            if tools:
                # should only be one tool
                tool = list(tools.keys())[0]
                # load all vent.template options into dict
                for section in tools[tool]:
                    template_dict[section] = json.loads(tools[tool][section])
            else:
                status = (False, "Couldn't get vent.template information")
        if status[0]:
            # display all those options as they would in the file
            for section in template_dict:
                return_str += '[' + section + ']\n'
                # ensure instances shows up in configuration
                for option in template_dict[section]:
                    if option.startswith('#'):
                        return_str += option + '\n'
                    else:
                        return_str += option + ' = '
                        return_str += template_dict[section][option] + '\n'
                return_str += '\n'
            # only one newline at end of file
            status = (True, return_str[:-1])
        return status
22740
def get_dag_configs(self) -> Dict[str, Dict[str, Any]]:
        
        return {dag: self.config[dag] for dag in self.config.keys() if dag != "default"}
80746
def config_value_keys(self, sortkey = False):
        
        ret = set()
        cls = type(self)
        while True:
            root = cls.getConfigRoot()
            if root:
                ret = ret.union(set(root.config_value_keys()))
            parent = None
            for c in cls.__bases__:
                if issubclass(c, Configurable):
                    parent = c
            if parent is None:
                break
            cls = parent
        if sortkey:
            return sorted(list(ret))
        else:
            return list(ret)
513430
def _parse_current_network_settings():
    '''
    
    '''
    opts = salt.utils.odict.OrderedDict()
    opts['networking'] = ''

    if os.path.isfile(_DEB_NETWORKING_FILE):
        with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents:
            for line in contents:
                salt.utils.stringutils.to_unicode(line)
                if line.startswith('#'):
                    continue
                elif line.startswith('CONFIGURE_INTERFACES'):
                    opts['networking'] = line.split('=', 1)[1].strip()

    hostname = _parse_hostname()
    domainname = _parse_domainname()
    searchdomain = _parse_searchdomain()

    opts['hostname'] = hostname
    opts['domainname'] = domainname
    opts['searchdomain'] = searchdomain
    return opts
428353
async def get_config(self):
        
        config_facade = client.ModelConfigFacade.from_connection(
            self.connection()
        )
        result = await config_facade.ModelGet()
        config = result.config
        for key, value in config.items():
            config[key] = ConfigValue.from_json(value)
        return config