Failure to resolve advertise address isn't fatal

This commit is contained in:
Michael Schurter 2016-11-07 17:25:34 -08:00
parent c735589f41
commit fbcc0ddbf5
1 changed files with 6 additions and 2 deletions

View File

@ -246,8 +246,12 @@ func (c *Command) readConfig() *Config {
}
ip, err := net.ResolveIPAddr("ip", host)
if err != nil {
c.Ui.Error(fmt.Sprintf("Unable to resolve hostname to set advertise address: %v", err))
return false
// Just because this node can't resolve its advertise
// address doesn't mean it's a bad address; use it
defaultAdvertise = host
newaddr := fmt.Sprintf("%s:%d", defaultAdvertise, port)
*addr = newaddr
return true
}
if ip.IP.IsLoopback() && !dev {
c.Ui.Error("Unable to select default advertise address as hostname resolves to localhost")