Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
cmd/juju/user: set controller name properly #7092
Conversation
| @@ -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") |
| @@ -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") |
mjs
Mar 13, 2017
Contributor
Just checking, are there still some tests which check user logins without -u?
|
Looks good overall. @juju/docs: Possible minor docs impact here. |
| - if controllerHost == "" { | ||
| - if !c.forceHost { | ||
| - return errNotControllerLogin | ||
| + logger.Infof("controllerLogin") |
| +(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. |
mjs
Mar 14, 2017
Contributor
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.
| - if controllerHost == "" { | ||
| - if !c.forceHost { | ||
| - return errNotControllerLogin | ||
| + logger.Infof("controllerLogin") |
| @@ -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") |
mjs
Mar 13, 2017
Contributor
Just checking, are there still some tests which check user logins without -u?
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
rogpeppe commentedMar 13, 2017
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.