Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmd/influx): allow for creating users without initial passwords in influx user create #20657

Merged
merged 5 commits into from
Feb 2, 2021

Conversation

danxmoran
Copy link
Contributor

Closes #20645

I manually tested the case of setting a password without specifying an org, it's tough to unit-test because the org-flag helpers are coded to read a global config file as a fallback when no flags are passed in.

Copy link
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure if we should try to set the Org if we can't set the password, but maybe that's correct (saving the user another redo step when they set the password).

Minor point anyway.

pass := b.password
if orgID == 0 && pass == "" {
return b.printUser(userPrintOpts{user: user})
orgID, setOrgErr := b.org.getID(dep.orgSvc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to bail earlier (i.e., here) if setPassErr != nil, and not try to set the Org?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll restore the previous bail-out order (org first if ID is specified, then password). Better to not rock the boat too much on a patch release.

}

if pass != "" && orgID == 0 {
return errors.New("an org id is required when providing a user password")
if setPassErr != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving this above the attempt to set the organization.

@danxmoran danxmoran force-pushed the dm-create-user-with-password-20645 branch 2 times, most recently from 152298d to 7945461 Compare February 2, 2021 15:41
@danxmoran danxmoran changed the title fix(cmd/influx): decouple setting init password and org membership for new users fix(cmd/influx): allow for creating users without initial passwords in influx user create Feb 2, 2021
@danxmoran danxmoran force-pushed the dm-create-user-with-password-20645 branch from c256321 to a03324e Compare February 2, 2021 16:01
Copy link
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks clean and clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'influx user create' cmd without -p flag misleading
2 participants