Browse Source

etcdctl: fixes 9583. trim spaces in ETCDCTL_ENDPOINTS

Vimal K 7 years ago
parent
commit
807dfcea78
1 changed files with 5 additions and 0 deletions
  1. 5 0
      etcdctl/ctlv3/command/global.go

+ 5 - 0
etcdctl/ctlv3/command/global.go

@@ -394,6 +394,11 @@ func endpointsFromCmd(cmd *cobra.Command) ([]string, error) {
 	// If domain discovery returns no endpoints, check endpoints flag
 	if len(eps) == 0 {
 		eps, err = cmd.Flags().GetStringSlice("endpoints")
+		if err == nil {
+			for i, ip := range eps {
+				eps[i] = strings.TrimSpace(ip)
+			}
+		}
 	}
 	return eps, err
 }