Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5329)

Issue 51450047: Preliminary support for basic juju id commands: (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 2 months ago by mattyw
Modified:
10 years ago
Reviewers:
mp+205715, dimitern, fwereade, rog
Visibility:
Public.

Description

Preliminary support for basic juju id commands: juju add-user <username> <password> if password is not supplied uses gopass to take the password from the command line juju remove-user <username> doesn't actually remove the user. But mark them as inactive add-user and remove-user aren't registered yet as they are useless without login. But the details of this are still being worked out. This branch also contains fixes for lp:1285256. The EnvCommandBase includes a function for ensuring the envname is not "". https://code.launchpad.net/~mattyw/juju-core/user-add-remove-cli/+merge/205715 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : Started adding cli for add|remove users #

Patch Set 3 : Started adding cli for add|remove users #

Patch Set 4 : Started adding cli for add|remove users #

Patch Set 5 : Started adding cli for add|remove users #

Patch Set 6 : Started adding cli for add|remove users #

Patch Set 7 : Started adding cli for add|remove users #

Patch Set 8 : Started adding cli for add|remove users #

Patch Set 9 : Started adding cli for add|remove users #

Patch Set 10 : Preliminary support for basic juju id commands: #

Total comments: 57

Patch Set 11 : Preliminary support for basic juju id commands: #

Patch Set 12 : Preliminary support for basic juju id commands: #

Patch Set 13 : Preliminary support for basic juju id commands: #

Unified diffs Side-by-side diffs Delta from patch set Stats (+497 lines, -109 lines) Patch
A [revision details] View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/cmd.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -22 lines 0 comments Download
M cmd/envcmd/environmentcommand.go View 1 2 3 4 5 6 7 8 9 10 4 chunks +15 lines, -2 lines 0 comments Download
M cmd/envcmd/environmentcommand_test.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +21 lines, -18 lines 0 comments Download
M cmd/envcmd/export_test.go View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M cmd/juju/addmachine.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/addrelation.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/addunit.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -1 line 0 comments Download
A cmd/juju/adduser.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +71 lines, -0 lines 0 comments Download
A cmd/juju/adduser_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +28 lines, -0 lines 0 comments Download
M cmd/juju/authorisedkeys_add.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/authorisedkeys_delete.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/authorisedkeys_import.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/authorisedkeys_list.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +10 lines, -1 line 0 comments Download
M cmd/juju/bootstrap.go View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/cmd_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download
M cmd/juju/constraints.go View 1 2 3 4 5 6 7 8 9 10 5 chunks +11 lines, -2 lines 0 comments Download
M cmd/juju/debuglog_test.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -2 lines 0 comments Download
M cmd/juju/deploy.go View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/destroymachine.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/destroyrelation.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/destroyservice.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/destroyunit.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/endpoint.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/environment.go View 1 2 3 4 5 6 7 8 9 10 5 chunks +11 lines, -2 lines 0 comments Download
M cmd/juju/expose.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/get.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/plugin.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -2 lines 0 comments Download
M cmd/juju/publish.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/publish_test.go View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
A cmd/juju/removeuser.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +55 lines, -0 lines 0 comments Download
A cmd/juju/removeuser_test.go View 1 2 3 4 5 6 7 8 9 10 1 chunk +25 lines, -0 lines 0 comments Download
M cmd/juju/resolved.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/run.go View 1 2 3 4 5 6 7 8 9 10 4 chunks +8 lines, -2 lines 0 comments Download
M cmd/juju/set.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/ssh.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/status.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -2 lines 0 comments Download
M cmd/juju/switch.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -2 lines 0 comments Download
M cmd/juju/switch_test.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -2 lines 0 comments Download
M cmd/juju/synctools.go View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/unexpose.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/unset.go View 1 2 3 4 5 6 7 8 9 10 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/upgradecharm.go View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +6 lines, -1 line 0 comments Download
M cmd/juju/upgradejuju.go View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +6 lines, -1 line 0 comments Download
M cmd/jujud/run.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download
M cmd/jujud/run_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +4 lines, -3 lines 0 comments Download
M cmd/package_test.go View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M cmd/plugins/juju-metadata/imagemetadata.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download
M cmd/plugins/juju-metadata/toolsmetadata.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download
M cmd/plugins/juju-metadata/validateimagemetadata.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download
M cmd/plugins/juju-metadata/validatetoolsmetadata.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download
M cmd/plugins/juju-restore/restore.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download
M cmd/supercommand.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download
M errors/errors.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +20 lines, -0 lines 0 comments Download
M juju/api.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +9 lines, -0 lines 0 comments Download
M juju/osenv/vars_windows_test.go View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M state/api/params/params.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +6 lines, -0 lines 0 comments Download
M state/apiserver/client/api_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M state/user.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -0 lines 0 comments Download
M state/user_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +11 lines, -6 lines 0 comments Download
M testing/environ.go View 1 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -0 lines 0 comments Download
M utils/ssh/ssh.go View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -2 lines 0 comments Download
M utils/ssh/ssh_test.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 4
mattyw
Please take a look.
10 years, 2 months ago (2014-02-20 15:00:00 UTC) #1
dimitern
I'm not quite sure changing NewAPIFrom name and replacing configstore.Store with EnvironInfo is a good ...
10 years, 2 months ago (2014-02-25 11:56:07 UTC) #2
rog
I haven't finished the review yet, I'm afraid, but publishing interim comments anyway. Looks good ...
10 years, 2 months ago (2014-02-26 17:14:29 UTC) #3
fwereade
10 years, 1 month ago (2014-03-06 11:57:47 UTC) #4
A few comments, let me know your thoughts.

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/adduser_test.go
File cmd/juju/adduser_test.go (right):

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/adduser_test.go#...
cmd/juju/adduser_test.go:13: type AdduserSuite struct {
On 2014/02/25 11:56:07, dimitern wrote:
> s/AdduserSuite/AddUserSuite/

...and similar changes across the board please.

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/adduser_test.go#...
cmd/juju/adduser_test.go:25: c.Assert(err, gc.ErrorMatches, "user already
exists")
sorry, I didn't pay proper attention to the initial CL -- would we accept an
empty password? and is there any facility for having juju autogenerate a strong
password?

And I'd also really like it if add-user could directly generate a .jenv that you
can just email directly to the new user. Sane?

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/login.go
File cmd/juju/login.go (right):

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/login.go#newcode73
cmd/juju/login.go:73: defer conn.Close()
may as well just close the conn here, right? and check the error :)

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/login.go#newcode80
cmd/juju/login.go:80: return nil
I'm a little bit uncertain about this... ISTM that it enables a (future) path by
which you can add a user with restricted perms; log in as that user; and whoops,
you've overwritten the only copy of your admin creds.

If we have add-user emitting .jenvs, though, then login could plausibly *accept*
a .jenv to be copied into the environments dir (and warn before overwriting an
existing one). Sensible?

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/login_test.go
File cmd/juju/login_test.go (right):

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/login_test.go#ne...
cmd/juju/login_test.go:25: _, err = testing.RunCommand(c, &AdduserCommand{},
[]string{"foobar", "password"})
On 2014/02/26 17:14:29, rog wrote:
> On 2014/02/25 11:56:07, dimitern wrote:
> > Now this appears a few times and it's worth having:
> > 
> > func runLogin(user, pass string) error {
> >     _, err := testing.RunCommand(c, &LoginCommand{}, []string{user, pass})
> >     return err
> > }
> > 
> 
> I actually disagree here - they're both a single line only,
> and and the existing version is clearer (you don't need
> to go looking for runLogin to find out that it's running
> the LoginCommand code).

LoginSuite.run(c *gc.C, args ...string) might work though. I have yet to be
convinced that it's a good idea to duplicate code just to avoid reading a
trivial function implementation -- once you've read it once, you *know* what it
does and you don't need to keep checking back, but if you dupe the code
everywhere you have to read it everywhere -- and it enables a whole class of
screwups where you *think* it does the same thing it does everywhere else, but
is actually subtly different.

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/whoami.go
File cmd/juju/whoami.go (right):

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/whoami.go#newcode23
cmd/juju/whoami.go:23: Purpose: "prints the name of the currently logged in
user",
And, hmm, given what we're doing with the .jenv, I'm wondering if there isn't a
big overlap with `juju switch` here.

https://codereview.appspot.com/51450047/diff/180001/cmd/juju/whoami.go#newcode29
cmd/juju/whoami.go:29: c.out.AddFlags(f, "yaml", map[string]cmd.Formatter{
On 2014/02/25 11:56:07, dimitern wrote:
> s/"yaml"/"format"/ ? see how other similar commands define the format arg.

Further to this, I think it might be appropriate to have the "smart" formatter
by default; even if it ain't really all that smart, it's consistent with other
uses.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b