Read the bootstrap-osd key for `cluster`.
326246
def get_bootstrap_osd_key(cluster):
    
    path = '{cluster}.bootstrap-osd.keyring'.format(cluster=cluster)
    try:
        with open(path, 'rb') as f:
            return f.read()
    except IOError:
        raise RuntimeError('bootstrap-osd keyring not found; run \'gatherkeys\'')
793568
def get_supported_boot_mode(self):
        
        system = self._get_host_details()
        bios_uefi_class_val = 0  # value for bios_only boot mode
        if ('Bios' in system['Oem']['Hp'] and
                'UefiClass' in system['Oem']['Hp']['Bios']):
            bios_uefi_class_val = (system['Oem']['Hp']
                                         ['Bios']['UefiClass'])
        return mappings.GET_SUPPORTED_BOOT_MODE_RIS_MAP.get(
            bios_uefi_class_val)
692310
def get_open_fds():
    
    pid = os.getpid()
    procs = subprocess.check_output(["lsof", '-w', '-Ff', "-p", str(pid)])
    procs = procs.decode("utf-8")

    return len([s for s in procs.split('\n')
                if s and s[0] == 'f' and s[1:].isdigit()])
207144
def parse_clusters(config)
        OodCore::Clusters.load_file(config || '/etc/ood/config/clusters.d')
      rescue OodCore::ConfigurationNotFound
        OodCore::Clusters.new([])
      end
865820
def get_cluster_info(host, port, ignore_cluster_errors=False):
    
    client = Telnet(host, int(port))
    client.write(b'version\n')
    res = client.read_until(b'\r\n').strip()
    version_list = res.split(b' ')
    if len(version_list) not in [2, 3] or version_list[0] != b'VERSION':
        raise WrongProtocolData('version', res)
    version = version_list[1]
    if StrictVersion(smart_text(version)) >= StrictVersion('1.4.14'):
        cmd = b'config get cluster\n'
    else:
        cmd = b'get AmazonElastiCache:cluster\n'
    client.write(cmd)
    regex_index, match_object, res = client.expect([
        re.compile(b'\n\r\nEND\r\n'),
        re.compile(b'ERROR\r\n')
    ])
    client.close()

    if res == b'ERROR\r\n' and ignore_cluster_errors:
        return {
            'version': version,
            'nodes': [
                '{0}:{1}'.format(smart_text(host),
                               smart_text(port))
            ]
        }

    ls = list(filter(None, re.compile(br'\r?\n').split(res)))
    if len(ls) != 4:
        raise WrongProtocolData(cmd, res)

    try:
        version = int(ls[1])
    except ValueError:
        raise WrongProtocolData(cmd, res)
    nodes = []
    try:
        for node in ls[2].split(b' '):
            host, ip, port = node.split(b'|')
            nodes.append('{0}:{1}'.format(smart_text(ip or host),
                                        smart_text(port)))
    except ValueError:
        raise WrongProtocolData(cmd, res)
    return {
        'version': version,
        'nodes': nodes
    }
245362
private void readClusterNodeInfo(CoronaSerializer coronaSerializer)
    throws IOException {
  coronaSerializer.readField("clusterNodeInfo");
    clusterNodeInfo = new ClusterNodeInfo();
    // Expecting the START_OBJECT token for clusterNodeInfo
    coronaSerializer.readStartObjectToken("clusterNodeInfo");

    coronaSerializer.readField("name");
    clusterNodeInfo.name = coronaSerializer.readValueAs(String.class);

    coronaSerializer.readField("address");
    clusterNodeInfo.address = coronaSerializer.readValueAs(InetAddress.class);

    coronaSerializer.readField("total");
    clusterNodeInfo.total = coronaSerializer.readValueAs(ComputeSpecs.class);

    coronaSerializer.readField("free");
    clusterNodeInfo.free = coronaSerializer.readValueAs(ComputeSpecs.class);

    coronaSerializer.readField("resourceInfos");
    clusterNodeInfo.resourceInfos = coronaSerializer.readValueAs(Map.class);

    // Expecting the END_OBJECT token for clusterNodeInfo
    coronaSerializer.readEndObjectToken("clusterNodeInfo");
  }
156074
def _readClusterSettings(self):
        
        instanceMetaData = get_instance_metadata()
        region = zoneToRegion(self._zone)
        conn = boto.ec2.connect_to_region(region)
        instance = conn.get_all_instances(instance_ids=[instanceMetaData["instance-id"]])[0].instances[0]
        self.clusterName = str(instance.tags["Name"])
        self._buildContext()
        self._subnetID = instance.subnet_id
        self._leaderPrivateIP = instanceMetaData['local-ipv4']  # this is PRIVATE IP
        self._keyName = list(instanceMetaData['public-keys'].keys())[0]
        self._tags = self.getLeader().tags
        self._masterPublicKey = self._setSSH()
223362
def read_kioslaverc (kde_config_dir):
    """"""
    data = {}
    filename = os.path.join(kde_config_dir, "kioslaverc")
    with open(filename) as fd:
        # First read all lines into dictionary since they can occur
        # in any order.
        for line in  fd:
            line = line.rstrip()
            if line.startswith('['):
                in_proxy_settings = line.startswith("[Proxy Settings]")
            elif in_proxy_settings:
                if '=' not in line:
                    continue
                key, value = line.split('=', 1)
                key = key.strip()
                value = value.strip()
                if not key:
                    continue
                # trim optional localization
                key = loc_ro.sub("", key).strip()
                if not key:
                    continue
                add_kde_setting(key, value, data)
    resolve_kde_settings(data)
    return data
1026537
def keyring(cluster, hostname):
    
    keyring_file = '%s-%s.mon.keyring' % (cluster, hostname)
    return join(constants.tmp_path, keyring_file)
1351818
def get(cluster_id, broker=None):
        
        if not broker:
            broker = get_broker()
        pack = broker.get_stat(Stat.get_key(cluster_id))
        if pack:
            try:
                return SignedPackage.loads(pack)
            except BadSignature:
                return None
        return Status(cluster_id)
708116
def get_clusters(self, platform, retry_contexts, all_clusters):
        '''  '''

        possible_cluster_info = {}
        candidates = set(copy.copy(all_clusters))
        while candidates and not possible_cluster_info:
            wait_for_any_cluster(retry_contexts)

            for cluster in sorted(candidates, key=attrgetter('priority')):
                ctx = retry_contexts[cluster.name]
                if ctx.in_retry_wait:
                    continue
                if ctx.failed:
                    continue
                try:
                    cluster_info = self.get_cluster_info(cluster, platform)
                    possible_cluster_info[cluster] = cluster_info
                except OsbsException:
                    ctx.try_again_later(self.find_cluster_retry_delay)
            candidates -= set([c for c in candidates if retry_contexts[c.name].failed])

        ret = sorted(possible_cluster_info.values(), key=lambda c: c.cluster.priority)
        ret = sorted(ret, key=lambda c: c.load)
        return ret
722906
def _ppid():
    '''
    
    '''
    ret = {}
    if __grains__['kernel'] == 'SunOS':
        cmd = 'ps -a -o pid,ppid | tail +2'
    else:
        cmd = 'ps -ax -o pid,ppid | tail -n+2'
    out = __salt__['cmd.run'](cmd, python_shell=True)
    for line in out.splitlines():
        pid, ppid = line.split()
        ret[pid] = ppid
    return ret
205265
def _get_store_by_name(self, name):
        """"""
        for cls in self.storage_type_map.values():
            cluster_files = glob.glob(
                '%s/%s.%s' % (self.storage_path, name, cls.file_ending))
            if cluster_files:
                try:
                    return cls(self.storage_path)
                except:
                    continue
        raise ClusterNotFound("No cluster %s was found" % name)
1037210
def cluster_commit():
    '''
    
    '''
    ret = {'comment': '', 'success': False}

    cmd = __execute_cmd('riak-admin', 'cluster commit')

    if cmd['retcode'] != 0:
        ret['comment'] = cmd['stdout']
    else:
        ret['comment'] = cmd['stdout']
        ret['success'] = True

    return ret
76829
def lsmod():
    '''
    
    '''
    ret = []
    for line in __salt__['cmd.run']('kldstat').splitlines():
        comps = line.split()
        if not len(comps) > 2:
            continue
        if comps[0] == 'Id':
            continue
        if comps[4] == 'kernel':
            continue
        ret.append({
            'module': comps[4][:-3],
            'size': comps[3],
            'depcount': comps[1]
        })
    return ret
605755
def get_local(self, key, default=None):
        
        key = '%s.%s.%s' % (self.key, 'local-data', key)
        return unitdata.kv().get(key, default)
664833
def _get_fs(self):
        '''
        
        '''

        data = dict()
        for dev, dev_data in salt.utils.fsutils._blkid().items():
            dev = self._get_disk_size(dev)
            device = dev.pop('device')
            dev['type'] = dev_data['type']
            data[device] = dev

        return data