Commit bab556f7 authored by Ed Bartosh's avatar Ed Bartosh

kubeadm: improve hostport parsing error messages

Added hostport and host/port parts to the error messages produced by ParseHostPort API. This should help users to better identify parsing issues. Fixes: kubernetes/kubeadm#1159
parent 50e02fd0
......@@ -95,7 +95,7 @@ func ParseHostPort(hostport string) (string, string, error) {
// if port is defined, parse and validate it
if port != "" {
if _, err := ParsePort(port); err != nil {
return "", "", errors.New("port must be a valid number between 1 and 65535, inclusive")
return "", "", errors.Errorf("hostport %s: port %s must be a valid number between 1 and 65535, inclusive", hostport, port)
}
}
......@@ -109,7 +109,7 @@ func ParseHostPort(hostport string) (string, string, error) {
return host, port, nil
}
return "", "", errors.New("host must be a valid IP address or a valid RFC-1123 DNS subdomain")
return "", "", errors.Errorf("hostport %s: host '%s' must be a valid IP address or a valid RFC-1123 DNS subdomain", hostport, host)
}
// ParsePort parses a string representing a TCP port.
......
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