Skip to content

Commit

Permalink
Merge pull request #5230 from vbotbuildovich/backport-4282-v22.1.x-869
Browse files Browse the repository at this point in the history
[v22.1.x] rpk: fix ipv6 parsing of ParseHostMaybeScheme function
  • Loading branch information
twmb committed Jun 26, 2022
2 parents 8cd0539 + 908934c commit 61f46f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit 61f46f3

Please sign in to comment.