Returns the output of dump for each server.

        :param hosts: comma separated lists of members of the ZK ensemble.
        :returns: A dictionary of ((server_ip, port), ClientInfo).
491466
def dump_by_server(self, hosts):
        
        dump_by_endpoint = {}

        for endpoint in self._to_endpoints(hosts):
            try:
                out = self.cmd([endpoint], "dump")
            except self.CmdFailed as ex:
                out = ""
            dump_by_endpoint[endpoint] = out

        return dump_by_endpoint
457872
def get_host_addresses(use_ipv4, use_ipv6):
    
    addresses = []
    for interface in netifaces.interfaces():
        ifaddresses = netifaces.ifaddresses(interface)
        for address in ifaddresses.get(socket.AF_INET, []):
            if use_ipv4 and address['addr'] != '127.0.0.1':
                addresses.append(address['addr'])
        for address in ifaddresses.get(socket.AF_INET6, []):
            if use_ipv6 and address['addr'] != '::1' and '%' not in address['addr']:
                addresses.append(address['addr'])
    return addresses
525629
def get_unit_hostnames(self, units):
        """"""
        host_names = {}
        for unit in units:
            host_names[unit.info['unit_name']] = \
                str(unit.file_contents('/etc/hostname').strip())
        self.log.debug('Unit host names: {}'.format(host_names))
        return host_names
62036
def get_host(self):
        
        import socket
        host_name = socket.gethostname()
        for h in hosts:
            if h['name'] == host_name:
                return h['type'], h['name']
        return dict(type='Unknown', name=host_name)
1006233
def display_servers(server_definitions_filename):
    
    servers = ServerDefinitionFile2(server_definitions_filename)

    title = 'List of all servers that can be tested'

    headers = ['Name', 'Url', 'Default_namespace']
    rows = []
    for server in servers.list_all_servers():
        # specifically does not show server user and pw
        rows.append((server.nickname,
                     server.url,
                     server.default_namespace))

    print_table(title, headers, rows, sort_columns=0)
756338
def host_list(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'This function must be called with -f, --function argument.'
        )
    ret = {}
    session = _get_session()
    hosts = session.xenapi.host.get_all()
    for host in hosts:
        host_record = session.xenapi.host.get_record(host)
        ret[host_record['name_label']] = host_record
    return ret
604588
def get_servers(self, topic):
        

        return (nsq.node.ServerNode(sh) for sh in self.__server_hosts)
1353246
def hosts_to_endpoints(hosts, port=2181):
    
    endpoints = []
    for host in hosts.split(","):
        endpoints.append(tuple(host.rsplit(":", 1)) if ":" in host else (host, port))
    return endpoints
401159
def gethosts(self):
        
        self.hosts = get_ip_scope_hosts(self.auth, self.url, self.id)
1243674
def ephemerals_info(self, hosts):
        
        info_by_path, info_by_id = {}, {}

        for server_endpoint, dump in self.dump_by_server(hosts).items():
            server_ip, server_port = server_endpoint
            sid = None
            for line in dump.split("\n"):
                mat = self.SESSION_REGEX.match(line)
                if mat:
                    sid = mat.group(1)
                    continue

                mat = self.PATH_REGEX.match(line)
                if mat:
                    info = info_by_id.get(sid, None)
                    if info is None:
                        info = info_by_id[sid] = ClientInfo(sid)
                    info_by_path[mat.group(1)] = info
                    continue

                mat = self.IP_PORT_REGEX.match(line)
                if mat:
                    ip, port, sid = mat.groups()
                    if sid not in info_by_id:
                        continue
                    info_by_id[sid](ip, int(port), server_ip, server_port)

        return info_by_path
1161342
def GetNumCoresOnHosts(hosts, private_key):
  
  results = runner.Runner(host_list=hosts, private_key=private_key,
                          module_name='setup').run()
  num_cores_list = []
  for _, props in results['contacted'].iteritems():
    cores = props['ansible_facts']['ansible_processor_cores']
    val = 0
    try:
      val = int(cores)
    except ValueError:
      pass
    num_cores_list.append(val)
  return num_cores_list
1045976
def failed_hosts(self) -> Dict[str, "MultiResult"]:
        
        return {k: v for k, v in self.result.items() if v.failed}
178542
def _hosts_in_unenumerated_pattern(self, pattern):
        

        hosts = {}
        # ignore any negative checks here, this is handled elsewhere
        pattern = pattern.replace("!","").replace("&", "")

        groups = self.get_groups()
        for group in groups:
            for host in group.get_hosts():
                if pattern == 'all' or self._match(group.name, pattern) or self._match(host.name, pattern):
                    hosts[host.name] = host
        return sorted(hosts.values(), key=lambda x: x.name)
381683
def host_names(urls):
    '''
    
    '''
    host_names = StringCounter()
    for url in urls:
        host_names[urlparse(url).netloc] += urls[url]
    return host_names
1259923
def status(self, host=None):
        
        if host is None:
            host_cores = self.host_cores
        else:
            host_cores = [hc for hc in self.host_cores if hc[0] == host]
        lst = []
        for host, _ in host_cores:
            ready = general.socket_ready((host, self.ctrl_port))
            lst.append((host, 'running' if ready else 'not-running'))
        return lst
303421
def get_host_cpu_name():
    
    with ffi.OutputString() as out:
        ffi.lib.LLVMPY_GetHostCPUName(out)
        return str(out)
493174
def getHostsFromFile(filename):
    """"""
    valid_hostname = r"^[^ /\t=\n]+"
    workers = r"\d+"
    hostname_re = re.compile(valid_hostname)
    worker_re = re.compile(workers)
    hosts = []
    with open(filename) as f:
        for line in f:
            # check to see if it is a SLURM grouping instead of a
            # regular list of hosts
            if re.search('[\[\]]', line):
                hosts = hosts + parseSLURM(line.strip())
            else:
                host = hostname_re.search(line.strip())
                if host:
                    hostname = host.group()
                    n = worker_re.search(line[host.end():])
                    if n:
                        n = n.group()
                    else:
                        # Automatically assign based on CPU count
                        n = 0
                    hosts.append((hostname, int(n)))
    return hosts