Get the configuration for a cache cluster.

    CLI example::

        salt myminion boto_elasticache.get_config myelasticache
13132
def get_config(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if not conn:
        return None
    try:
        cc = conn.describe_cache_clusters(name,
                                          show_cache_node_info=True)
    except boto.exception.BotoServerError as e:
        msg = 'Failed to get config for cache cluster {0}.'.format(name)
        log.error(msg)
        log.debug(e)
        return {}
    cc = cc['DescribeCacheClustersResponse']['DescribeCacheClustersResult']
    cc = cc['CacheClusters'][0]
    ret = odict.OrderedDict()
    attrs = ['engine', 'cache_parameter_group', 'cache_cluster_id',
             'cache_security_groups', 'replication_group_id',
             'auto_minor_version_upgrade', 'num_cache_nodes',
             'preferred_availability_zone', 'security_groups',
             'cache_subnet_group_name', 'engine_version', 'cache_node_type',
             'notification_configuration', 'preferred_maintenance_window',
             'configuration_endpoint', 'cache_cluster_status', 'cache_nodes']
    for key, val in six.iteritems(cc):
        _key = boto.utils.pythonize_name(key)
        if _key not in attrs:
            continue
        if _key == 'cache_parameter_group':
            if val:
                ret[_key] = val['CacheParameterGroupName']
            else:
                ret[_key] = None
        elif _key == 'cache_nodes':
            if val:
                ret[_key] = [k for k in val]
            else:
                ret[_key] = []
        elif _key == 'cache_security_groups':
            if val:
                ret[_key] = [k['CacheSecurityGroupName'] for k in val]
            else:
                ret[_key] = []
        elif _key == 'configuration_endpoint':
            if val:
                ret['port'] = val['Port']
                ret['address'] = val['Address']
            else:
                ret['port'] = None
                ret['address'] = None
        elif _key == 'notification_configuration':
            if val:
                ret['notification_topic_arn'] = val['TopicArn']
            else:
                ret['notification_topic_arn'] = None
        else:
            ret[_key] = val
    return ret
339853
def get_conn(opts, profile=None, host=None, port=None):
    '''
    
    '''
    if not (host and port):
        opts_pillar = opts.get('pillar', {})
        opts_master = opts_pillar.get('master', {})

        opts_merged = {}
        opts_merged.update(opts_master)
        opts_merged.update(opts_pillar)
        opts_merged.update(opts)

        if profile:
            conf = opts_merged.get(profile, {})
        else:
            conf = opts_merged

        host = conf.get('memcached.host', DEFAULT_HOST)
        port = conf.get('memcached.port', DEFAULT_PORT)

    if not six.text_type(port).isdigit():
        raise SaltInvocationError('port must be an integer')

    if HAS_LIBS:
        return memcache.Client(['{0}:{1}'.format(host, port)])
    else:
        raise CommandExecutionError(
            '(unable to import memcache, '
            'module most likely not installed)'
        )
1210722
def get_vsan_cluster_config_system(service_instance):
    '''
    
    '''

    #TODO Replace when better connection mechanism is available

    #For python 2.7.9 and later, the defaul SSL conext has more strict
    #connection handshaking rule. We may need turn of the hostname checking
    #and client side cert verification
    context = None
    if sys.version_info[:3] > (2, 7, 8):
        context = ssl.create_default_context()
        context.check_hostname = False
        context.verify_mode = ssl.CERT_NONE

    stub = service_instance._stub
    vc_mos = vsanapiutils.GetVsanVcMos(stub, context=context)
    return vc_mos['vsan-cluster-config-system']
856561
public function getElasticConfig($key = 'config', $prefix = 'elasticquent')
    {
        $key = $prefix . ($key ? '.' : '') . $key;

        if (function_exists('config')) {
            // Get config helper for Laravel 5.1+
            $config_helper = config();
        } elseif (function_exists('app')) {
            // Get config helper for Laravel 4 & Laravel 5.1
            $config_helper = app('config');
        } else {
            // Create a config helper when using stand-alone Eloquent
            $config_helper = $this->getConfigHelper();
        }

        return $config_helper->get($key);
    }
224394
def create(name, num_cache_nodes=None, engine=None, cache_node_type=None,
           replication_group_id=None, engine_version=None,
           cache_parameter_group_name=None, cache_subnet_group_name=None,
           cache_security_group_names=None, security_group_ids=None,
           snapshot_arns=None, preferred_availability_zone=None,
           preferred_maintenance_window=None, port=None,
           notification_topic_arn=None, auto_minor_version_upgrade=None,
           wait=None, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    try:
        conn.create_cache_cluster(
            name, num_cache_nodes, cache_node_type, engine,
            replication_group_id, engine_version, cache_parameter_group_name,
            cache_subnet_group_name, cache_security_group_names,
            security_group_ids, snapshot_arns, preferred_availability_zone,
            preferred_maintenance_window, port, notification_topic_arn,
            auto_minor_version_upgrade)
        if not wait:
            log.info('Created cache cluster %s.', name)
            return True
        while True:
            time.sleep(3)
            config = get_config(name, region, key, keyid, profile)
            if not config:
                return True
            if config['cache_cluster_status'] == 'available':
                return True
        log.info('Created cache cluster %s.', name)
    except boto.exception.BotoServerError as e:
        msg = 'Failed to create cache cluster {0}.'.format(name)
        log.error(msg)
        log.debug(e)
        return False
1334759
def get_group_host(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if not conn:
        return None
    try:
        cc = conn.describe_replication_groups(name)
    except boto.exception.BotoServerError as e:
        msg = 'Failed to get config for cache cluster {0}.'.format(name)
        log.error(msg)
        log.debug(e)
        return {}

    cc = cc['DescribeReplicationGroupsResponse']['DescribeReplicationGroupsResult']
    cc = cc['ReplicationGroups'][0]['NodeGroups'][0]['PrimaryEndpoint']
    host = cc['Address']
    return host
660155
def read_mount_cache(name):
    '''
    
    '''
    cache = salt.utils.mount.read_cache(__opts__)
    if cache:
        if 'mounts' in cache and cache['mounts']:
            if name in cache['mounts']:
                return cache['mounts'][name]
    return {}
287333
public ClusterConfigration getConfig(String key)
      throws MemcachedException, InterruptedException, TimeoutException {
    Command cmd = this.commandFactory.createAWSElasticCacheConfigCommand("get", key);
    final Session session = this.sendCommand(cmd);
    this.latchWait(cmd, opTimeout, session);
    cmd.getIoBuffer().free();
    this.checkException(cmd);
    String result = (String) cmd.getResult();
    if (result == null) {
      throw new MemcachedException("Operation fail,may be caused by networking or timeout");
    }
    return AWSUtils.parseConfiguration(result);
  }
1000397
def gather_cache(self):
        '''
        
        '''
        cache = {'grains': {}, 'pillar': {}}
        if self.grains or self.pillar:
            if self.opts.get('minion_data_cache'):
                minions = self.cache.list('minions')
                if not minions:
                    return cache
                for minion in minions:
                    total = self.cache.fetch('minions/{0}'.format(minion), 'data')

                    if 'pillar' in total:
                        if self.pillar_keys:
                            for key in self.pillar_keys:
                                if key in total['pillar']:
                                    cache['pillar'][minion][key] = total['pillar'][key]
                        else:
                            cache['pillar'][minion] = total['pillar']
                    else:
                        cache['pillar'][minion] = {}

                    if 'grains' in total:
                        if self.grain_keys:
                            for key in self.grain_keys:
                                if key in total['grains']:
                                    cache['grains'][minion][key] = total['grains'][key]
                        else:
                            cache['grains'][minion] = total['grains']
                    else:
                        cache['grains'][minion] = {}
        return cache
598166
def getConfigRoot(cls, create = False):
        
        try:
            return manager.gettree(getattr(cls, 'configkey'), create)
        except AttributeError:
            return None
407178
def get_configuration():
    
    root = getLogger()
    name_levels = [('', logging.getLevelName(root.level))]
    name_levels.extend(
        (name, logging.getLevelName(logger.level))
        for name, logger
        in root.manager.loggerDict.items()
        if hasattr(logger, 'level')
    )

    config_string = ','.join('%s:%s' % x for x in name_levels)

    return dict(config_string=config_string, log_json=SLogger.manager.log_json)
1067027
def key_values_cache_key_name(cls, *key_fields):
        
        key_fields = key_fields or cls.KEY_FIELDS
        return 'configuration/{}/key_values/{}'.format(cls.__name__, ','.join(key_fields))
793551
def get_config(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    retries = 30
    while True:
        try:
            asg = conn.get_all_groups(names=[name])
            if asg:
                asg = asg[0]
            else:
                return {}
            ret = odict.OrderedDict()
            attrs = ['name', 'availability_zones', 'default_cooldown',
                    'desired_capacity', 'health_check_period',
                    'health_check_type', 'launch_config_name', 'load_balancers',
                    'max_size', 'min_size', 'placement_group',
                    'vpc_zone_identifier', 'tags', 'termination_policies',
                    'suspended_processes']
            for attr in attrs:
                # Tags are objects, so we need to turn them into dicts.
                if attr == 'tags':
                    _tags = []
                    for tag in asg.tags:
                        _tag = odict.OrderedDict()
                        _tag['key'] = tag.key
                        _tag['value'] = tag.value
                        _tag['propagate_at_launch'] = tag.propagate_at_launch
                        _tags.append(_tag)
                    ret['tags'] = _tags
                # Boto accepts a string or list as input for vpc_zone_identifier,
                # but always returns a comma separated list. We require lists in
                # states.
                elif attr == 'vpc_zone_identifier':
                    ret[attr] = getattr(asg, attr).split(',')
                # convert SuspendedProcess objects to names
                elif attr == 'suspended_processes':
                    suspended_processes = getattr(asg, attr)
                    ret[attr] = sorted([x.process_name for x in suspended_processes])
                else:
                    ret[attr] = getattr(asg, attr)
            # scaling policies
            policies = conn.get_all_policies(as_group=name)
            ret["scaling_policies"] = []
            for policy in policies:
                ret["scaling_policies"].append(
                    dict([
                        ("name", policy.name),
                        ("adjustment_type", policy.adjustment_type),
                        ("scaling_adjustment", policy.scaling_adjustment),
                        ("min_adjustment_step", policy.min_adjustment_step),
                        ("cooldown", policy.cooldown)
                    ])
                )
            # scheduled actions
            actions = conn.get_all_scheduled_actions(as_group=name)
            ret['scheduled_actions'] = {}
            for action in actions:
                end_time = None
                if action.end_time:
                    end_time = action.end_time.isoformat()
                ret['scheduled_actions'][action.name] = dict([
                  ("min_size", action.min_size),
                  ("max_size", action.max_size),
                  # AWS bug
                  ("desired_capacity", int(action.desired_capacity)),
                  ("start_time", action.start_time.isoformat()),
                  ("end_time", end_time),
                  ("recurrence", action.recurrence)
                ])
            return ret
        except boto.exception.BotoServerError as e:
            if retries and e.code == 'Throttling':
                log.debug('Throttled by AWS API, retrying in 5 seconds...')
                time.sleep(5)
                retries -= 1
                continue
            log.error(e)
            return {}
1238415
def _get_memcache_timeout(self, key, options=None):
    """"""
    timeout = ContextOptions.memcache_timeout(options)
    if timeout is None:
      timeout = self._memcache_timeout_policy(key)
    if timeout is None:
      timeout = ContextOptions.memcache_timeout(self._conn.config)
    if timeout is None:
      timeout = 0
    return timeout
675275
protected static function _getConfig() {
        if (null === self::$_classConfigCacheEnabled) {
            self::$_classConfigCacheEnabled = CM_Config::get()->classConfigCacheEnabled;
        }

        $calledClass = get_called_class();
        $cacheKey = CM_CacheConst::ClassConfig . '_className:' . $calledClass;
        $cache = new CM_Cache_Storage_Apc();
        if (!self::$_classConfigCacheEnabled || !isset(self::$_classConfigList[$calledClass])) {
            if (!self::$_classConfigCacheEnabled || false === ($result = $cache->get($cacheKey))) {
                $result = self::_getConfigRaw();
                if (self::$_classConfigCacheEnabled) {
                    $cache->set($cacheKey, $result);
                }
            }
            self::$_classConfigList[$calledClass] = $result;
        }

        return self::$_classConfigList[$calledClass];
    }
1062119
def _get_config(**api_opts):
    '''
    
    '''
    config = {
        'api_sslverify': True,
        'api_url': 'https://INFOBLOX/wapi/v1.2.1',
        'api_user': '',
        'api_key': '',
    }
    if '__salt__' in globals():
        config_key = '{0}.config'.format(__virtualname__)
        config.update(__salt__['config.get'](config_key, {}))
    # pylint: disable=C0201
    for k in set(config.keys()) & set(api_opts.keys()):
        config[k] = api_opts[k]
    return config
553798
def get_config(self):
        
        if 'rmq_port' in self.config:
            self.rmq_port = int(self.config['rmq_port'])

        if 'rmq_user' in self.config:
            self.rmq_user = self.config['rmq_user']

        if 'rmq_password' in self.config:
            self.rmq_password = self.config['rmq_password']

        if 'rmq_vhost' in self.config:
            self.rmq_vhost = self.config['rmq_vhost']

        if 'rmq_exchange_type' in self.config:
            self.rmq_exchange_type = self.config['rmq_exchange_type']

        if 'rmq_durable' in self.config:
            self.rmq_durable = bool(self.config['rmq_durable'])

        if 'rmq_heartbeat_interval' in self.config:
            self.rmq_heartbeat_interval = int(
                self.config['rmq_heartbeat_interval'])