influxdata / influx-cli

CLI for managing resources in InfluxDB v2
MIT License
61 stars 22 forks source link

Required --user flag problems: prevents token creation on cloud2 offering using cli #506

Open reidkaufmann opened 1 year ago

reidkaufmann commented 1 year ago

It seems I cannot create tokens on a cloud2 instance. I might be missing something here…

user@host:~/pa$ influx auth create --write-bucket testdata -d "token description"
Error: could not find user with name "": %!w(<nil>)
user@host:~/pa$ influx user create --name bob
Error: failed to create user "bob": 401 Unauthorized: write:users is unauthorized

Furthermore, the user flag, if actually required, is not handled well: The --user flag is missing, but the output is a little cryptic and indicates it executed with unset variables.

$ influx auth create --write-bucket testdata
Error: could not find user with name "": %!w(<nil>)

What might be nicer: Error: Required flag “user” not set

Also, usage is usually printed when a required parameter is missing, but not in this instance. This is annoying.

$ influx auth create
Error: could not find user with name "": %!w(<nil>)

This was observed using the 2.7.1-2 amd64 package available at https://portal.influxdata.com/downloads/ with build_date: 2023-04-06T15:31:37Z

There are other methods/interfaces for creating authorization tokens, so the impact is limited.