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
cmd/juju/user: set controller name properly #7092
cmd/juju/user: set controller name properly #7092
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loginDoc
needs to be updated to reflect this change
cmd/juju/user/login.go
Outdated
@@ -128,6 +129,7 @@ func (c *loginCommand) Init(args []string) error { | |||
|
|||
// Run implements Command.Run. | |||
func (c *loginCommand) Run(ctx *cmd.Context) error { | |||
logger.Infof("in loginCommand.Run") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debugging remnant, deleted
@@ -76,7 +76,7 @@ func (s *LoginCommandSuite) TestInitError(c *gc.C) { | |||
} | |||
|
|||
func (s *LoginCommandSuite) TestLogin(c *gc.C) { | |||
stdout, stderr, code := runLogin(c, "current-user\nsekrit\n") | |||
stdout, stderr, code := runLogin(c, "current-user\nsekrit\n", "-u") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking, are there still some tests which check user logins without -u?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't do a user login without -u any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, no problems
Looks good overall. @juju/docs: Possible minor docs impact here. |
dbf7d6d
to
71ba0ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cmd/juju/user/login.go
Outdated
if controllerHost == "" { | ||
if !c.forceHost { | ||
return errNotControllerLogin | ||
logger.Infof("controllerLogin") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Info looks high for this message, left over debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed that this probably shouldn't be here
6db30d6
to
a2ad6bb
Compare
cmd/juju/user/login.go
Outdated
(either a known public controller or the host name of a public | ||
controller). In this case, the -c flag can be used to choose a name for | ||
the new controller. The -u flag causes it to log into a controller as a | ||
local user instead - the -c flag names a current controller in this case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be clearer for the above paragraph:
By default, the juju login command logs the user into a public controller. If the controller is already known it can be specified by name. Alternatively, the host name of a public controller can be specified. The -c flag can be used to specify a name for the controller when a host name is provided.
If the -u flag is provided, the juju login command will attempt to log into a controller as a local user. In this case, the -c flag names the controller to log in to.
This still assumes a fair bit of knowledge (e.g. the "public controller" and "local user" concepts) but I think it's clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better, thanks. Done.
cmd/juju/user/login.go
Outdated
if controllerHost == "" { | ||
if !c.forceHost { | ||
return errNotControllerLogin | ||
logger.Infof("controllerLogin") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed that this probably shouldn't be here
@@ -76,7 +76,7 @@ func (s *LoginCommandSuite) TestInitError(c *gc.C) { | |||
} | |||
|
|||
func (s *LoginCommandSuite) TestLogin(c *gc.C) { | |||
stdout, stderr, code := runLogin(c, "current-user\nsekrit\n") | |||
stdout, stderr, code := runLogin(c, "current-user\nsekrit\n", "-u") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, no problems
a2ad6bb
to
e83f06d
Compare
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
Build failed: Tests failed |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
Because the controller wasn't being set, the ListControllers
call was failing. The tests still passed because the ListControllers
call was entirely mocked.
Also make a backwardly incompatible change so that the old
"juju login $user" behaviour is no longer the default - to log in as
a user, the "--user" (or "-u") flag is required.