Return config profile list from DCNM.
164522
def config_profile_list(self):
        """"""

        these_profiles = self._config_profile_list() or []
        profile_list = [q for p in these_profiles for q in
                        [p.get('profileName')]]
        return profile_list
274761
def workers(profile='default'):
    '''
    
    '''

    config = get_running(profile)
    lbn = config['worker.list'].split(',')
    worker_list = []
    ret = {}

    for lb in lbn:
        try:
            worker_list.extend(
                config['worker.{0}.balance_workers'.format(lb)].split(',')
            )
        except KeyError:
            pass

    worker_list = list(set(worker_list))

    for worker in worker_list:
        ret[worker] = {
            'activation': config['worker.{0}.activation'.format(worker)],
            'state': config['worker.{0}.state'.format(worker)],
        }

    return ret
1021380
def getProfile(self, profile=None):
    '''
    
    '''
    if profile is None:
      # todo: what if the configuration `profile.default` does not exist?
      profile = self.config.get('DEFAULT', 'profile.default')
    if profile in self.profiles:
      return self.profiles[profile].init()
    for prof in self.profiles.values():
      if prof.name == profile:
        return prof.init()
    for prof in self.profiles.values():
      if prof.name.lower() == profile.lower():
        return prof.init()
    raise KeyError(profile)
27804
def get_profiles(self, profile_base="/data/b2g/mozilla", timeout=None):
        

        rv = {}

        if timeout is None:
            timeout = self._timeout

        profile_path = posixpath.join(profile_base, "profiles.ini")
        try:
            proc = self.shell("cat %s" % profile_path, timeout=timeout)
            config = ConfigParser.ConfigParser()
            config.readfp(proc.stdout_file)
            for section in config.sections():
                items = dict(config.items(section))
                if "name" in items and "path" in items:
                    path = items["path"]
                    if "isrelative" in items and int(items["isrelative"]):
                        path = posixpath.normpath("%s/%s" % (profile_base, path))
                    rv[items["name"]] = path
        finally:
            proc.stdout_file.close()
            proc.stderr_file.close()

        return rv
910594
def config(self):
		""""""

		response = self._call(
			mc_calls.Config
		)
		config_list = response.body.get('data', {}).get('entries', [])

		return config_list
904761
def _get_credentials():
    '''
    
    '''
    ret = {
        'user': False,
        'passwd': False
    }

    # Loop through opts, grains, and pillar
    # Return the first acceptable configuration found
    for item in ret:
        for struct in [__opts__, __grains__, __pillar__]:
            # Look for the config key
            # Support old-style config format and new
            for config_key in __valid_configs[item]:
                value = salt.utils.data.traverse_dict_and_list(
                    struct,
                    config_key,
                    None)
                if value:
                    ret[item] = value
                    break
    return ret['user'], ret['passwd']
1109509
def get_config():
    """"""
    if CONFIG_FILE is not None:
        configfile = CONFIG_FILE
    else:
        configfile = BUILTIN_CONFIG_FILE

    config = {}
    with open(configfile, 'r') as fp_:
        config = recursive_dict_update(config, yaml.load(fp_, Loader=UnsafeLoader))

    app_dirs = AppDirs('pyspectral', 'pytroll')
    user_datadir = app_dirs.user_data_dir
    config['rsr_dir'] = expanduser(config.get('rsr_dir', user_datadir))
    config['rayleigh_dir'] = expanduser(config.get('rayleigh_dir', user_datadir))

    return config
932078
def service_list(profile=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)
    ret = {}
    for service in kstone.services.list():
        ret[service.name] = dict((value, getattr(service, value)) for value in dir(service)
                                 if not value.startswith('_') and
                                 isinstance(getattr(service, value), (six.string_types, dict, bool)))
    return ret
163175
def role_list(profile=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)
    ret = {}
    for role in kstone.roles.list():
        ret[role.name] = dict((value, getattr(role, value)) for value in dir(role)
                              if not value.startswith('_') and
                              isinstance(getattr(role, value), (six.string_types, dict, bool)))
    return ret
560229
def profiles(self):
        """"""
        selected_profiles = []
        for config in self.included_profiles:
            profile_selected = False
            profile_name = config.get('profile_name')

            if profile_name == self.args.profile:
                profile_selected = True
            elif config.get('group') is not None and config.get('group') == self.args.group:
                profile_selected = True
            elif self.args.group in config.get('groups', []):
                profile_selected = True

            if profile_selected:
                install_json_filename = config.get('install_json')
                ij = {}
                if install_json_filename is not None:
                    ij = self.load_install_json(install_json_filename)
                config['install_json'] = ij
                selected_profiles.append(config)

            self.reports.add_profile(config, profile_selected)

        if not selected_profiles:
            print('{}{}No profiles selected to run.'.format(c.Style.BRIGHT, c.Fore.YELLOW))

        return selected_profiles
278111
def get_profiles(self):
        
        out = set()
        for ft in self.features.values():
            out.update(ft.get_profiles())
        for ext in self.extensions.values():
            out.update(ext.get_profiles())
        return out
813825
def list(cls, options=None, target=None):
        
        options = options or {}

        result = []
        if not target or target == 'paas':
            for profile in cls.safe_call('paas.snapshotprofile.list', options):
                profile['target'] = 'paas'
                result.append((profile['id'], profile))

        if not target or target == 'vm':
            for profile in cls.safe_call('hosting.snapshotprofile.list',
                                         options):
                profile['target'] = 'vm'
                result.append((profile['id'], profile))

        result = sorted(result, key=lambda item: item[0])
        return [profile for id_, profile in result]
1119923
def getConf(cls, settings, options):
        ""
        ports = ['http_port', 'https_port', 'cache_port']
        for port_name in ports:
            port = getattr(settings, port_name.upper(), None)
            # only use the settings ports if the defaults were left unchanged
            default = getattr(defaults, port_name.upper())
            if port and options.get(port_name) == default:
                options[port_name] = port

        _opts = [
            ('key', 'hx_private_key'),
            ('cert', 'hx_certficate'),
            ('wsgi', 'wsgi_application')
        ]
        for opt_name, settings_name in _opts:
            opt = getattr(settings, settings_name.upper(), None)
            if opt:
                options[opt_name] = opt

        if not options['settings']:
            options['settings'] = environ['DJANGO_SETTINGS_MODULE']
        return options
128523
def list_service_profiles(self, retrieve_all=True, **_params):
        """"""
        return self.list('service_profiles', self.service_profiles_path,
                         retrieve_all, **_params)
943601
def config_cred(config, providers):
    """"""
    expected = ['aws', 'azure', 'gcp', 'alicloud']
    cred = {}
    to_remove = []
    for item in providers:
        if any(item.startswith(itemb) for itemb in expected):
            try:
                cred[item] = dict(list(config[item].items()))
            except KeyError as e:
                print("No credentials section in config file for {} -"
                      " provider will be skipped.".format(e))
                to_remove.append(item)
        else:
            print("Unsupported provider: '{}' listed in config - ignoring"
                  .format(item))
            to_remove.append(item)
    return cred, to_remove
1369245
def extract_configs(self):
        

        nvram_file = os.path.join(self.working_dir, "nvram_{:05d}".format(self.application_id))
        if not os.path.exists(nvram_file):
            return None, None
        try:
            with open(nvram_file, "rb") as file:
                nvram_content = file.read()
        except OSError as e:
            log.warning("Cannot read nvram file {}: {}".format(nvram_file, e))
            return None, None

        try:
            startup_config_content, private_config_content = nvram_export(nvram_content)
        except ValueError as e:
            log.warning("Could not export configs from nvram file {}: {}".format(nvram_file, e))
            return None, None

        return startup_config_content, private_config_content
1067191
def get_snmp_information(self):
        """"""

        # Default values
        snmp_dict = {
            'chassis_id': '',
            'location': '',
            'contact': '',
            'community': {}
        }

        commands = [
            'show snmp chassis',
            'show snmp location',
            'show snmp contact'
        ]
        snmp_config = self.device.run_commands(commands, encoding='json')
        for line in snmp_config:
            for k, v in line.items():
                if k == 'chassisId':
                    snmp_dict['chassis_id'] = v
                else:
                    # Some EOS versions add extra quotes
                    snmp_dict[k] = v.strip('"')

        commands = ['show running-config | section snmp-server community']
        raw_snmp_config = self.device.run_commands(commands, encoding='text')[0].get('output', '')
        for line in raw_snmp_config.splitlines():
            match = self._RE_SNMP_COMM.search(line)
            if match:
                matches = match.groupdict('')
                snmp_dict['community'][match.group('community')] = {
                    'acl': py23_compat.text_type(matches['v4_acl']),
                    'mode': py23_compat.text_type(matches['access'])
                }

        return snmp_dict