Make user management messages more informative #7035

Merged
merged 1 commit into from Feb 28, 2017

Conversation

Projects
None yet
5 participants
Contributor

reedobrien commented Feb 25, 2017

Description of change

Why is this change needed?

This reworks the error messages when adding and removing users. It
essentially returns "user unavailable" rather than "not found" when
deleting and "is permanently deleted" rather than "user exists".

It also changes a bunch of gocheck asserts into checks where is made no
sense to fail the suite on the first error.

QA steps

How do we verify that the change works?

  1. Bootstrap a controller, say lxd juju bootstrap lxd lp/1630728
  2. Add a user:
$ juju add-user jjam
User "jjam" added
Please send this command to jjam:
    juju register snip...

"jjam" has not been granted access to any models. You can use "juju grant" to grant access.
  1. Try adding it again and ensure it says unavailable rather than not found
juju add-user jjaM
ERROR failed to create user: username unavailable
  1. Delete the user and verify the confirmation message is informative.
$ juju remove-user jjam
WARNING! This command will permanently archive the user "jjam" on the "lp/1630728_remove-user"
controller.

This action is irreversible. If you wish to temporarily disable the
user please use the `juju disable-user` command. See
 `juju help disable-user` for more details.

Continue (y/N)? y
User "jjam" removed
  1. Try to remove the user again and ensure we have unavailable instead of not found.
$ juju remove-user jjam -y
ERROR failed to delete user "jjam": the user has already been permanently deleted
  1. Try to add a user with the same name
$ juju add-user jjaM
ERROR failed to create user: username unavailable

Documentation changes

Does it affect current user workflow? CLI? API?
It changes some output but not input.

Bug reference

Does this change fix a bug? Please add a link to it.

Refs: https://bugs.launchpad.net/juju/+bug/1630728

Make user management messages more informative
This reworks the error messages when adding and removing users. It
essentially returns "user unavailable" rather than "not found" when
deleting and "is permanently deleted" rather than "user exists".

It also changes a bunch of gocheck asserts into checks where is made no
sense to fail the suite on the first error.

Refs: https://bugs.launchpad.net/juju/+bug/1630728

@reedobrien this is great! +1

Owner

jameinel commented Feb 26, 2017

Owner

jameinel commented Feb 26, 2017

Member

anastasiamac commented Feb 26, 2017

@jameinel
For normal user management, users should be enabled/disabled rather than removed as per the comments in the bug.
For user removal, the behavior is different - we do not destroy entities that user owns or created when the user is removed: models, applications, etc. This means that if another user with the same name may be allowed to be added, this user will gain access to all these left-over components. Effectively, if we allow the "resurrection" of removed users, the behavior will be surprising :)
As a result, we have decided to disallow the reuse of user name once the user is removed for the life of the controller.

Owner

jameinel commented Feb 27, 2017

As far improving messages is concerned, the proposal improves them :D
We'd need to address remove/resurrect users as a separate follow-up

Contributor

reedobrien commented Feb 27, 2017

$$merge$$

Contributor

jujubot commented Feb 27, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 0cfda3a into juju:develop Feb 28, 2017

@reedobrien reedobrien deleted the reedobrien:lp/1630728_remove-user-messages branch Feb 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment