Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v22.1.x] rpk: fix ipv6 parsing of ParseHostMaybeScheme function #5230

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/go/rpk/pkg/cli/cmd/redpanda/admin/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ failure of enabling each logger is individually printed.
cmd.Flags().StringVarP(&level, "level", "l", "debug", "log level to set (error, warn, info, debug, trace)")
cmd.Flags().IntVarP(&expirySeconds, "expiry-seconds", "e", 300, "seconds to persist this log level override before redpanda reverts to its previous settings (if 0, persist until shutdown)")

cmd.Flags().StringVar(&host, "host", "", "either an index into admin_api hosts to issue the request to, or a hostname")
cmd.Flags().StringVar(&host, "host", "", "either a hostname or an index into rpk.admin_api.addresses config section to select the hosts to issue the request to")
cobra.MarkFlagRequired(cmd.Flags(), "host")

return cmd
Expand Down
4 changes: 3 additions & 1 deletion src/go/rpk/pkg/net/hostport.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ func ParseHostMaybeScheme(h string) (scheme, host string, err error) {
return "", "", err
}
if port != "" {
return scheme, net.JoinHostPort(host, port), nil
// We can return host + port since splitSchemeHostPort already
// ensures an IPV6 host is wrapped in brackets.
return scheme, host + ":" + port, nil
}
return scheme, host, nil
}
Expand Down