Closed hash-d closed 1 month ago
I've done some quick testing, and it seems the other flags, placed before or after --platform
are unaffected (ie, their presence and values are respected).
My guess is that this is occurring because of the unchecked rootCmd.ParseFlags
at the start of the init()
function on cmd/skupper/skupper.go
, before the actual flags are defined later on that function.
I think that call is failing because of the unknown (at the time of parsing) first option passed to the command line. Cobra probably even parses --platform
correctly later on the execution, but only after the call to config.GetPlatform()
that is used to select the SkuppeClient
has already occurred.
@fgiorgetti FYI
Well... After opening the ticket I checked the status on main, and this is actually a duplicate of #1147, already fixed on #1451
I had not seen those before, as I searched for --platform
instead of just platform
.
Closing this as a dup
Describe the bug
If a different flag precedes
--platform
on the command line, the value given to it is ignored.How To Reproduce
Try a
skupper init
with--platform
not as the first flag:Notice that the command above installed skupper on the K8S namespace
dh-1248
, instead of the requested podman install.See that changing the placement of the
--platform
flag causes the correct behavior to take place.Also, note that the value of the
--platform
is completely ignored:On the example above, the invalid value
asdf
was given to--platform
and yet it was allowed to continue.Expected behavior
Either:
--platform
should be respected, regardless of its position on the command line, or--platform
flag to be the first in the command line should be documentedI did not see anything on the documentation pointing to the necessity of
--platform
to be the first in the command line. Even in that case, an error should be generated when that's not in its proper place, instead of continuing with a configuration different from what the user specified.Environment details
Additional context
N/A