/* based on manager_info_hosts
340960
private void printInfoHost(StringBuilder buf, String uri, boolean reduceDisplay, boolean allowCmd, final Node node) {
        for (Node.VHostMapping host : node.getVHosts()) {
            if (!reduceDisplay) {
                buf.append("<h2> Virtual Host " + host.getId() + ":</h2>");
            }
            printInfoContexts(buf, uri, reduceDisplay, allowCmd, host.getId(), host, node);
            if (reduceDisplay) {
                buf.append("Aliases: ");
                for (String alias : host.getAliases()) {
                    buf.append(alias + " ");
                }
            } else {
                buf.append("<h3>Aliases:</h3>");
                buf.append("<pre>");
                for (String alias : host.getAliases()) {
                    buf.append(alias + "\n");
                }
                buf.append("</pre>");
            }
        }
    }
841559
private function _hostname()
    {
        if (PSI_USE_VHOST === true) {
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
        } else {
            if (CommonFunctions::executeProgram('uname', '-n', $result, PSI_DEBUG)) {
                $ip = gethostbyname($result);
                if ($ip != $result) {
                    $this->sys->setHostname(gethostbyaddr($ip));
                }
            }
        }
    }
904351
private String getDestinationHostName(String hostName) {
        List<ServerRedirect> servers = serverRedirectService
            .tableServers(requestInformation.get().client.getId());
        for (ServerRedirect server : servers) {
            if (server.getSrcUrl().compareTo(hostName) == 0) {
                if (server.getDestUrl() != null && server.getDestUrl().compareTo("") != 0) {
                    return server.getDestUrl();
                } else {
                    logger.warn("Using source URL as destination URL since no destination was specified for: {}",
                                server.getSrcUrl());
                }

                // only want to apply the first host name change found
                break;
            }
        }

        return hostName;
    }
1308686
public static function determineHostModel(): string
    {
        $hostModel = config('server-monitor.host_model') ?? Host::class;

        if (! is_a($hostModel, Host::class, true)) {
            throw InvalidConfiguration::hostModelIsNotValid($hostModel);
        }

        return $hostModel;
    }
792970
public static String hostNameOfDeployment(final WarMetaData metaData, final String defaultHost) {
		Collection<String> hostNames = null;
		if (metaData.getMergedJBossWebMetaData() != null) {
			hostNames = metaData.getMergedJBossWebMetaData().getVirtualHosts();
		}
		if (hostNames == null || hostNames.isEmpty()) {
			hostNames = Collections.singleton(defaultHost);
		}
		String hostName = hostNames.iterator().next();
		if (hostName == null) {
			throw ROOT_LOGGER.nullHostName();
		}
		return hostName;
	}
352689
function getDefaultSiteSettings(hostname) {
  const name = _.takeRight(hostname.split('.'), 2)[0]; // penultimate or last

  return {
    slug: name.toLowerCase(),
    name: _.startCase(name),
    host: hostname,
    path: '/',
    prefix: hostname,
    assetDir: 'public'
  };
}
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
104654
def cli(env, sortby, cpu, columns, datacenter, name, memory, disk, tag):
    """"""
    mgr = SoftLayer.DedicatedHostManager(env.client)
    hosts = mgr.list_instances(cpus=cpu,
                               datacenter=datacenter,
                               hostname=name,
                               memory=memory,
                               disk=disk,
                               tags=tag,
                               mask=columns.mask())

    table = formatting.Table(columns.columns)
    table.sortby = sortby

    for host in hosts:
        table.add_row([value or formatting.blank()
                       for value in columns.row(host)])

    env.fout(table)
162828
@Override
    public Host lookup( final String hostName )
    {
        boolean isNew = false;
        Host h = hosts.get( hostName );
        if ( h == null )
        {
            isNew = true;
            h = new Host();
        }

        if ( h.isPatternsApplied() )
        {
            return h;
        }

        if ( h.getHostName() == null )
        {
            h.setHostName( hostName );
        }

        if ( h.getUser() == null )
        {
            h.setUser( userName() );
        }

        if ( h.getPort() < 1 )
        {
            h.setPort( SSH_PORT );
        }

        h.setPatternsApplied( true );

        if ( isNew )
        {
            hosts.put( hostName, h );
        }

        return h;
    }
476563
private static String getHostnamesFromInstances(Iterable<TaskManagerLocation> locations) {
		StringBuilder bld = new StringBuilder();

		boolean successive = false;
		for (TaskManagerLocation loc : locations) {
			if (successive) {
				bld.append(", ");
			} else {
				successive = true;
			}
			bld.append(loc.getHostname());
		}

		return bld.toString();
	}
192763
def __get_hosts(self, pattern):
        

        (name, enumeration_details) = self._enumeration_info(pattern)
        hpat = self._hosts_in_unenumerated_pattern(name)
        hpat = sorted(hpat, key=lambda x: x.name)

        return set(self._apply_ranges(pattern, hpat))
1164669
protected function _getShopHostInfoFromServerVars()
    {
        // got here from setup dir
        $sScript = $_SERVER['SCRIPT_NAME'];
        $iPort = (int) $_SERVER['SERVER_PORT'];
        $blSsl = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on'));
        if (!$iPort) {
            $iPort = $blSsl ? 443 : 80;
        }
        $sScript = rtrim(dirname(dirname($sScript)), '/') . '/';

        return [
            'host' => $_SERVER['HTTP_HOST'],
            'port' => $iPort,
            'dir'  => $sScript,
            'ssl'  => $blSsl,
        ];
    }
887409
private synchronized HostServerGroupEffect getHostEffect(PathAddress address, String host, Resource root)  {
        if (requiresMapping) {
            map(root);
            requiresMapping = false;
        }
        Set<String> mapped = hostsToGroups.get(host);
        if (mapped == null) {
            // Unassigned host. Treat like an unassigned profile or socket-binding-group;
            // i.e. available to all server group scoped roles.
            // Except -- WFLY-2085 -- the master HC is not open to all s-g-s-rs
            Resource hostResource = root.getChild(PathElement.pathElement(HOST, host));
            if (hostResource != null) {
                ModelNode dcModel = hostResource.getModel().get(DOMAIN_CONTROLLER);
                if (!dcModel.hasDefined(REMOTE)) {
                    mapped = Collections.emptySet(); // prevents returning HostServerGroupEffect.forUnassignedHost(address, host)
                }
            }
        }
        return mapped == null ? HostServerGroupEffect.forUnassignedHost(address, host)
                : HostServerGroupEffect.forMappedHost(address, mapped, host);

    }
777580
public String getHosts() {
    if (isReference()) {
      final DistributerDef refDistributer = (DistributerDef) getCheckedRef(DistributerDef.class, "DistributerDef");
      return refDistributer.getHosts();
    }
    return this.hosts;
  }
1266851
def host2id(self, hostname):
        """"""
        for key, value in self.server_map.items():
            if value == hostname:
                return key
305033
def get_services(root, hosts_map, view=None):
  ''' 
  '''
  services_list = []
  mgmt_service = root.get_cloudera_manager().get_service()
  services_list.append({"hostname": CM_DUMMY_HOST,
                        "name": mgmt_service.name,
                        "display_name": "CM Managed Service: %s" % (mgmt_service.name,),
                        "status": get_status(mgmt_service),
                        "url": mgmt_service.serviceUrl,
                        "health_summary": mgmt_service.healthSummary})
  for cm_role in root.get_cloudera_manager().get_service().get_all_roles(view):
    services_list.append({"hostname": hosts_map[cm_role.hostRef.hostId]["hostname"],
                          "name": cm_role.name,
                          "display_name": "CM Management Service: %s" % (cm_role.name,),
                          "status": get_status(cm_role),
                          "url": cm_role.roleUrl,
                          "health_summary": cm_role.healthSummary})
  for cm_host in root.get_all_hosts(view):
    services_list.append({"hostname": hosts_map[cm_host.hostId]["hostname"],
                          "name": "cm-host-%s" % (cm_host.hostname,),
                          "display_name": "CM Managed Host: %s" % (cm_host.hostname,),
                          "status": get_status(cm_host),
                          "url": cm_host.hostUrl,
                          "health_summary": cm_host.healthSummary})
  for cluster in root.get_all_clusters(view):
    for service in cluster.get_all_services(view):
      services_list.append({"hostname": cluster.name,
                            "name": service.name,
                            "display_name": "CM Managed Service: %s" % (service.name,),
                            "status": get_status(service),
                            "url": service.serviceUrl,
                            "health_summary": service.healthSummary})
      for role in service.get_all_roles(view):
        services_list.append({"hostname": hosts_map[role.hostRef.hostId]["hostname"],
                              "name": role.name,
                              "display_name": "%s:%s" % (cluster.name, role.name,),
                              "status": get_status(role),
                              "url": role.roleUrl,
                              "health_summary": role.healthSummary})
  return services_list
602264
private void findHostname() {
    String startupInfo = Environment.runCommand(
        "grep --max-count=1 STARTUP_MSG:\\s*host " + file.getName()).toString();
    Pattern pattern = Pattern.compile("\\s+(\\w+/.+)\\s+");
    Matcher matcher = pattern.matcher(startupInfo);
    if (matcher.find(0)) {
      hostname = matcher.group(1).split("/")[0];
      ips = new String[1];
      ips[0] = matcher.group(1).split("/")[1];
    }
  }