Merge pull request #71258 from bart0sh/PR0042-kubeadm-1159-improve-hostport-error-messages

kubeadm: improve hostport parsing error messages
pull/564/head
Kubernetes Prow Robot 2018-12-09 23:59:06 -08:00 committed by GitHub
commit 21a8d08fab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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.