cmd/juju/user: add "logout" command #4909

Merged
merged 1 commit into from Apr 4, 2016

Conversation

Projects
None yet
3 participants
Member

axw commented Mar 29, 2016

"juju logout" will remove the user credentials
for the specified/current controller. If there
is a password but no macaroon recorded for the
user, then the user must either acquire a macaroon
by changing the password first, or use the --force
flag.

We now disallow a client logging in as multiple
users for a controller simultaneously, and
consequently drop the "juju switch-user" command.
You must first log out before logging in as another
user.

c.Assert(err, jc.ErrorIsNil)
c.Assert(coretesting.Stdout(context), gc.Equals, "")
c.Assert(coretesting.Stderr(context), gc.Equals, `
-password:
+username: password:
@howbazaar

howbazaar Apr 3, 2016

Owner

Curious as to why "username:" is on the same line as "password:" but not the "type password again:".

Why is this?

@axw

axw Apr 4, 2016

Member

When we read the username, output is echoed to the terminal; so when the user hits enter, a newline is printed. There's no echo for the password, so we print a newline out.

+ case 1:
+ ctx.Infof("Logged out. You are still logged into 1 controller.")
+ default:
+ ctx.Infof("Logged out. You are still logged into %d controllers.", loggedInCount)
Owner

howbazaar commented Apr 3, 2016

Generally LGTM, just one question about the output shown n the tests relating to new lines.
I'm assuming that this has been tested interactively?

Member

axw commented Apr 4, 2016

Generally LGTM, just one question about the output shown n the tests relating to new lines.
I'm assuming that this has been tested interactively?

Sure has. I had the newline after "username: " in the test originally, and then tested it interactively and took it out :) As mentioned, because we echo the username input, there's no need for us to add a newline to the output.

cmd/juju/user: add "logout" command
"juju logout" will remove the user credentials
for the specified/current controller. If there
is a password but no macaroon recorded for the
user, then the user must either acquire a macaroon
by changing the password first, or use the --force
flag.

We now disallow logging in as multiple users
for a controller simultaneously, and consequently
drop the switch-user command. You must first log
out before logging in as another user.
Member

axw commented Apr 4, 2016

$$merge$$

Contributor

jujubot commented Apr 4, 2016

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

@jujubot jujubot merged commit e54a77a into juju:master Apr 4, 2016

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