Merge pull request #7967 from yujuhong/uname_n

Don't use the first token `uname -n` as the hostname
pull/6/head
Victor Marmol 2015-05-08 13:30:43 -07:00
commit 2c0a047f62
1 changed files with 1 additions and 4 deletions

View File

@ -30,10 +30,7 @@ func GetHostname(hostnameOverride string) string {
if err != nil {
glog.Fatalf("Couldn't determine hostname: %v", err)
}
chunks := strings.Split(string(nodename), ".")
// nodename could be a fully-qualified domain name or not. Take the first
// word of nodename as the hostname for consistency.
hostname = chunks[0]
hostname = string(nodename)
}
return strings.ToLower(strings.TrimSpace(hostname))
}