Recursively fetch a list of each unique hostname that belongs in or
        under the group. This includes hosts in children groups.
437766
def _group_get_hostnames(self, group_name):
        
        hostnames = []

        hosts_section = self._get_section(group_name, 'hosts')
        if hosts_section:
            for entry in hosts_section['entries']:
                hostnames.extend(self.expand_hostdef(entry['name']))

        children_section = self._get_section(group_name, 'children')
        if children_section:
            for entry in children_section['entries']:
                hostnames.extend(self._group_get_hostnames(entry['name']))

        return hostnames
1359614
def _get_ids_from_hostname(self, hostname):
        """"""
        results = self.list_hardware(hostname=hostname, mask="id")
        return [result['id'] for result in results]
320543
def linkify_hostgroups_hosts(self, hosts):
        
        for hostgroup in self:
            members = hostgroup.get_hosts()
            # The new members identifiers list
            new_members = []
            for member in members:
                # member is an host name
                member = member.strip()
                if not member:  # void entry, skip this
                    continue

                if member == '*':
                    # All the hosts identifiers list
                    new_members.extend(list(hosts.items.keys()))
                else:
                    host = hosts.find_by_name(member)
                    if host is not None:
                        new_members.append(host.uuid)
                        if hostgroup.uuid not in host.hostgroups:
                            host.hostgroups.append(hostgroup.uuid)
                    else:
                        hostgroup.add_unknown_members(member)

            # Make members unique
            new_members = list(set(new_members))

            # We find the id, we replace the names
            hostgroup.replace_members(new_members)
283059
def get_groupnames(self, hostgroups):
        
        group_names = []
        for hostgroup_id in self.hostgroups:
            hostgroup = hostgroups[hostgroup_id]
            group_names.append(hostgroup.get_name())
        return ','.join(sorted(group_names))
846960
def get_all_hosts(resource_root, view=None):
  
  return call(resource_root.get, HOSTS_PATH, ApiHost, True,
          params=view and dict(view=view) or None)
381683
def host_names(urls):
    '''
    
    '''
    host_names = StringCounter()
    for url in urls:
        host_names[urlparse(url).netloc] += urls[url]
    return host_names
746038
def get_unique_groups(input_list):
    """"""
    out_list = []
    for item in input_list:
        if item not in out_list:
            out_list.append(item)
    return out_list
489951
def getHosts(filename=None, hostlist=None):
    """"""
    if filename:
        return getHostsFromFile(filename)
    elif hostlist:
        return getHostsFromList(hostlist)
    elif getEnv() == "SLURM":
        return getHostsFromSLURM()
    elif getEnv() == "PBS":
        return getHostsFromPBS()
    elif getEnv() == "SGE":
        return getHostsFromSGE()
    else:
        return getDefaultHosts()
1012534
private Iterator<IEntityGroup> getMemberGroups() throws GroupsException {

        Set<IEntityGroup> rslt = new HashSet<>();
        for (IGroupMember child : getChildren()) {
            if (child.isGroup()) {
                rslt.add((IEntityGroup) child);
            }
        }

        return rslt.iterator();
    }
631149
def lookup_family(hostname):
    '''
    
    '''
    # If lookups fail, fall back to AF_INET sockets (and v4 addresses).
    fallback = socket.AF_INET
    try:
        hostnames = socket.getaddrinfo(
            hostname or None, None, socket.AF_UNSPEC, socket.SOCK_STREAM
        )
        if not hostnames:
            return fallback
        h = hostnames[0]
        return h[0]
    except socket.gaierror:
        return fallback
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
240102
def get_members_of_group(self, gname):
        
        hostgroup = self.find_by_name(gname)
        if hostgroup:
            return hostgroup.get_services()
        return []
765758
def get_by_hostname(self, hostname):
        
        resources = self._client.get_all()

        resources_filtered = [x for x in resources if x['hostname'] == hostname]

        if resources_filtered:
            return resources_filtered[0]
        else:
            return None
225333
public static UniAddress getByName( String hostname,
                                        boolean possibleNTDomainOrWorkgroup )
                                        throws UnknownHostException {
        UniAddress[] addrs = UniAddress.getAllByName(hostname, possibleNTDomainOrWorkgroup);
        return addrs[0];
    }
490402
def _fetchAllChildren(self):
        
        childItems = []
        logger.debug("{!r} _fetchAllChildren {!r}".format(self, self.fileName))

        if self.hasChildren():
            for key, value in sorted(self._dictionary.items()):
                # TODO: pass the attributes to the children? (probably not)
                childItem = _createFromObject(value, str(key), self.fileName)
                childItem._iconColor = self.iconColor
                childItems.append(childItem)

        return childItems
640339
def _group_keys(self):
        
        return [name for name, child in iteritems(self._children) if isinstance(child, GroupNode)]
315453
def list_all_elements(self):
        
        res = []

        # We are a host/service
        if self.operand in ['host', 'service']:
            return [self.sons[0]]

        for son in self.sons:
            res.extend(son.list_all_elements())

        # and returns a list of unique uuids
        return list(set(res))