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

Issue 101760046: various: change API.Login() to handle EnvironTag

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 11 months ago by jameinel
Modified:
9 years, 11 months ago
Reviewers:
mp+221021, axw, fwereade
Visibility:
Public.

Description

various: change API.Login() to handle EnvironTag This changes a bit of Login handling to allow us to pass in an EnvironTag which will get validated against the running environment. We also return EnvironTag as part of the Login response, since otherwise the existing client doesn't have a good way of finding out that information. It then goes around and updates a bunch of places so that we can store the EnvironTag in our .jenv and read it back out (and pass it in). I went with a new error message (invalid environment requested), rather than just ErrPerm, partially because I have already validated the Login credentials. (Since one user is intended to have access to multiple environments, it made sense to layer it that way). It does still return the CodeUnauthorized. It is still valid to pass in an EnvironTag of "". Eventually we may change how Login works under that circumstance (for Multi Environment support), but for now this gets us closer to where we want to be. If we get to the point that Bootstrap actually stashes our api information it could also stash the environment tag. However, in the short term if it just connects to the API like everything else, it will get the environment UUID cached, which will let us be a bit more protected from accidentally connecting to the wrong environment. This might have implications for CI, as I believe they try to re-use things like CACerts so that they can use the same .jenv files across mulitple bootstraps. If so, this will start causing the client to get rejected because the actual environment has changed. Though I think that is the behavior that we decided we wanted. https://code.launchpad.net/~jameinel/juju-core/login-returns-env-tag/+merge/221021 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 13

Patch Set 2 : various: change API.Login() to handle EnvironTag #

Patch Set 3 : various: change API.Login() to handle EnvironTag #

Total comments: 11
Unified diffs Side-by-side diffs Delta from patch set Stats (+404 lines, -41 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M environs/configstore/disk.go View 1 3 chunks +5 lines, -2 lines 0 comments Download
M environs/configstore/interface.go View 1 1 chunk +4 lines, -0 lines 0 comments Download
M environs/configstore/interface_test.go View 1 2 chunks +6 lines, -4 lines 0 comments Download
M juju/api.go View 1 7 chunks +42 lines, -14 lines 2 comments Download
M juju/apiconn_test.go View 1 8 chunks +139 lines, -3 lines 2 comments Download
M juju/mock_test.go View 2 chunks +5 lines, -0 lines 0 comments Download
M state/api/apiclient.go View 4 chunks +14 lines, -1 line 0 comments Download
M state/api/apiclient_test.go View 2 chunks +22 lines, -0 lines 0 comments Download
M state/api/params/params.go View 2 chunks +6 lines, -4 lines 0 comments Download
M state/api/state.go View 2 chunks +6 lines, -4 lines 0 comments Download
M state/api/state_test.go View 3 chunks +48 lines, -0 lines 2 comments Download
M state/apiserver/admin.go View 2 chunks +21 lines, -1 line 2 comments Download
M state/apiserver/common/errors.go View 2 chunks +2 lines, -0 lines 0 comments Download
M state/apiserver/login_test.go View 1 7 chunks +82 lines, -8 lines 3 comments Download

Messages

Total messages: 7
jameinel
Please take a look.
9 years, 11 months ago (2014-05-27 06:48:38 UTC) #1
fwereade
This looks good. In the absence of completed API versioning I'd actually be happy to ...
9 years, 11 months ago (2014-05-27 07:27:58 UTC) #2
jameinel
Please take a look. https://codereview.appspot.com/101760046/diff/1/environs/configstore/disk.go File environs/configstore/disk.go (right): https://codereview.appspot.com/101760046/diff/1/environs/configstore/disk.go#newcode144 environs/configstore/disk.go:144: EnvironTag: info.EnvInfo.EnvironTag, On 2014/05/27 07:27:57, ...
9 years, 11 months ago (2014-05-27 09:53:30 UTC) #3
jameinel
Please take a look.
9 years, 11 months ago (2014-05-28 05:51:56 UTC) #4
axw
LGTM https://codereview.appspot.com/101760046/diff/40001/juju/api.go File juju/api.go (right): https://codereview.appspot.com/101760046/diff/40001/juju/api.go#newcode271 juju/api.go:271: environUUID := "" s/environUUID/environTag/ https://codereview.appspot.com/101760046/diff/40001/juju/apiconn_test.go File juju/apiconn_test.go (right): ...
9 years, 11 months ago (2014-05-29 03:59:25 UTC) #5
jameinel
Thanks for your review. I've superseded this request with this one: https://codereview.appspot.com/102920048/ However, hopefully I've ...
9 years, 11 months ago (2014-06-01 09:53:31 UTC) #6
axw
9 years, 11 months ago (2014-06-01 12:14:57 UTC) #7
https://codereview.appspot.com/101760046/diff/40001/state/apiserver/login_tes...
File state/apiserver/login_test.go (right):

https://codereview.appspot.com/101760046/diff/40001/state/apiserver/login_tes...
state/apiserver/login_test.go:519: 
On 2014/06/01 09:53:31, jameinel wrote:
> On 2014/05/29 03:59:25, axw wrote:
> > func (s *loginSuite) TestLoginAcceptsEmptyEnvironTag(c *gc.C) {
> > ...
> > }
> > 
> > ?
> 
> If you look, "TestLoginReportsEnvironTag" explicitly passes EnvironTag:""
which
> is the test you're looking for. Would you prefer a different name?
> 

Sorry, don't know how I missed that. That's fine.
Sign in to reply to this message.

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