scaleway-cli icon indicating copy to clipboard operation
scaleway-cli copied to clipboard

docs and error is misleading for `scw create container` with environment variables

Open lalyos opened this issue 3 years ago • 0 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Command attempted

Im trying to create a container from cli, by following the documentation (or cli description from --help)

$ scw container container create name=test namespace-id=$NS_ID environment-variables.value.FOO=bar
Cannot unmarshal arg 'environment-variables.value.FOO=bar': cannot set nested field for unmarshalable type string

Expected Behavior

The container is created.

Actual Behavior

The errormessage is dispplayed: Cannot unmarshal arg 'environment-variables.value.FOO=bar': cannot set nested field for unmarshalable type string

More info

The correct behaviour is happening when environment-variables.FOO=bar syntax is used instead of environment-variables.value.FOO=bar.

It seems that the implementation handles the value correctly, only the documentation is misleading. Changing the ArgSpecs in container_cli.go would fix the misleading cli --help.

But turned out that the go file is generated from internal protobuf spec (discussion with @remyleone on community slack).

By searching for the string environment-variables shows that not only generate go is infected but:

  • .md : the documentation is also generated probably from the same protobuf, so it will be fixed as well
  • .golden : there are specific test for checking the output of container creation, and right now they check for the misleading 'environment-variables.value form. So once the go code is fixexd, the golden files should be regenerated.

Note: The same issue true for functions like: scw function function create

lalyos avatar Dec 25 '21 08:12 lalyos