influxdata / influxdata/influx-cli

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

Open
#506 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
75
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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()
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()
```
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()
```

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the `influx auth create` and `influx user create` commands shown in the issue, then trace how the `--user` flag is validated for `auth create`. Done means a missing required flag produces a clear error and usage information instead of the current unset-user error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.