kubeadm: break out check for err and hostname

parent 2c0b3da4
...@@ -244,7 +244,10 @@ func (hc HostnameCheck) Check() (warnings, errors []error) { ...@@ -244,7 +244,10 @@ func (hc HostnameCheck) Check() (warnings, errors []error) {
errors = append(errors, fmt.Errorf("hostname \"%s\" %s", hostname, msg)) errors = append(errors, fmt.Errorf("hostname \"%s\" %s", hostname, msg))
} }
addr, err := net.LookupHost(hostname) addr, err := net.LookupHost(hostname)
if addr == nil || err != nil { if addr == nil {
errors = append(errors, fmt.Errorf("hostname \"%s\" could not be reached", hostname))
}
if err != nil {
errors = append(errors, fmt.Errorf("hostname \"%s\" %s", hostname, err)) errors = append(errors, fmt.Errorf("hostname \"%s\" %s", hostname, err))
} }
return nil, errors return nil, errors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment