protected String ensureHostname(String hostName) {
    return (hostName == null) ? StageUtils.getHostName() : hostName;
  }
Ensures that a hostname is returned. If null (indicating the host is the Ambari server), the
hostname of the Ambari server is returned.

@param hostName a hostname
@return the specified hostname or the hostname of the Ambari Server
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java