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

Issue 10044043: state/apiserver: Split Machiner into subpackage (Closed)

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

Description

state/apiserver: Split Machiner into subpackage Minor refactoring to put server-side Machiner facade into its own subpackage as suggested previously. As a side-effect errors and interfaces used had to be moved into another "common" subpackage to resolve circular imports. https://code.launchpad.net/~dimitern/juju-core/055-api-machiner-subpackages/+merge/167486 Requires: https://code.launchpad.net/~dimitern/juju-core/054-apiserver-split-suites/+merge/167284 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state/apiserver: Split Machiner into subpackage #

Patch Set 3 : state/apiserver: Split Machiner into subpackage #

Patch Set 4 : state/apiserver: Split Machiner into subpackage #

Total comments: 23

Patch Set 5 : state/apiserver: Split Machiner into subpackage #

Total comments: 6

Patch Set 6 : state/apiserver: Split Machiner into subpackage #

Total comments: 18

Patch Set 7 : state/apiserver: Split Machiner into subpackage #

Unified diffs Side-by-side diffs Delta from patch set Stats (+224 lines, -154 lines) Patch
A [revision details] View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/apierror.go View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M state/api/machiner_test.go View 1 2 3 4 5 1 chunk +3 lines, -3 lines 0 comments Download
M state/apiserver/apiserver.go View 1 2 3 4 5 6 2 chunks +7 lines, -0 lines 0 comments Download
M state/apiserver/common/errors.go View 1 2 3 4 5 6 4 chunks +28 lines, -36 lines 0 comments Download
A state/apiserver/common/interfaces.go View 1 2 3 4 5 6 1 chunk +33 lines, -0 lines 0 comments Download
M state/apiserver/errors_test.go View 1 2 3 4 5 6 3 chunks +21 lines, -18 lines 0 comments Download
D state/apiserver/export_test.go View 1 chunk +0 lines, -25 lines 0 comments Download
M state/apiserver/machiner/machiner.go View 1 2 3 4 5 6 4 chunks +26 lines, -14 lines 0 comments Download
M state/apiserver/machiner/machiner_test.go View 1 2 3 4 5 6 6 chunks +57 lines, -15 lines 0 comments Download
M state/apiserver/root.go View 1 2 3 4 5 6 13 chunks +41 lines, -38 lines 0 comments Download
M state/apiserver/user.go View 1 2 chunks +2 lines, -1 line 0 comments Download
M state/apiserver/watcher.go View 1 4 chunks +4 lines, -3 lines 0 comments Download

Messages

Total messages: 15
dimitern
Please take a look.
10 years, 10 months ago (2013-06-05 09:15:02 UTC) #1
fwereade
LGTM, but I'm not sure why we're referencing the packages as "apimachiner" and "apicommon" when ...
10 years, 10 months ago (2013-06-05 09:34:33 UTC) #2
dimitern
On 2013/06/05 09:34:33, fwereade wrote: > LGTM, but I'm not sure why we're referencing the ...
10 years, 10 months ago (2013-06-05 10:19:57 UTC) #3
dimitern
Please take a look.
10 years, 10 months ago (2013-06-05 10:24:18 UTC) #4
dimitern
Please take a look.
10 years, 10 months ago (2013-06-05 10:47:24 UTC) #5
dimitern
Please take a look.
10 years, 10 months ago (2013-06-05 10:53:04 UTC) #6
jameinel
I like that things are getting split out. I'm a little curious what *clients* will ...
10 years, 10 months ago (2013-06-05 11:26:28 UTC) #7
dimitern
On 2013/06/05 11:26:28, jameinel wrote: > I like that things are getting split out. > ...
10 years, 10 months ago (2013-06-05 11:29:25 UTC) #8
rog
given that we've chosen this direction (which, to reiterate, i disagree with), this is getting ...
10 years, 10 months ago (2013-06-05 16:30:42 UTC) #9
dimitern
Please take a look. https://codereview.appspot.com/10044043/diff/13/state/apiserver/common/errors.go File state/apiserver/common/errors.go (right): https://codereview.appspot.com/10044043/diff/13/state/apiserver/common/errors.go#newcode61 state/apiserver/common/errors.go:61: func ServerErrorToParams(err error) *params.Error { ...
10 years, 10 months ago (2013-06-06 09:36:01 UTC) #10
rog
https://codereview.appspot.com/10044043/diff/13/state/apiserver/common/errors.go File state/apiserver/common/errors.go (right): https://codereview.appspot.com/10044043/diff/13/state/apiserver/common/errors.go#newcode61 state/apiserver/common/errors.go:61: func ServerErrorToParams(err error) *params.Error { On 2013/06/06 09:36:01, dimitern ...
10 years, 10 months ago (2013-06-06 11:32:08 UTC) #11
dimitern
Please take a look. https://codereview.appspot.com/10044043/diff/13/state/apiserver/common/errors.go File state/apiserver/common/errors.go (right): https://codereview.appspot.com/10044043/diff/13/state/apiserver/common/errors.go#newcode61 state/apiserver/common/errors.go:61: func ServerErrorToParams(err error) *params.Error { ...
10 years, 10 months ago (2013-06-06 16:17:36 UTC) #12
rog
LGTM with the below issues fixed. https://codereview.appspot.com/10044043/diff/30001/state/apiserver/apiserver.go File state/apiserver/apiserver.go (right): https://codereview.appspot.com/10044043/diff/30001/state/apiserver/apiserver.go#newcode102 state/apiserver/apiserver.go:102: return *err s/*err/err/ ...
10 years, 10 months ago (2013-06-06 16:33:31 UTC) #13
fwereade
just one note to fix please https://codereview.appspot.com/10044043/diff/30001/state/apiserver/root.go File state/apiserver/root.go (right): https://codereview.appspot.com/10044043/diff/30001/state/apiserver/root.go#newcode61 state/apiserver/root.go:61: // us making ...
10 years, 10 months ago (2013-06-06 16:52:15 UTC) #14
dimitern
10 years, 10 months ago (2013-06-06 17:10:52 UTC) #15
*** Submitted:

state/apiserver: Split Machiner into subpackage

Minor refactoring to put server-side Machiner
facade into its own subpackage as suggested
previously.
As a side-effect errors and interfaces used
had to be moved into another "common" subpackage
to resolve circular imports.

R=fwereade, jameinel, rog
CC=
https://codereview.appspot.com/10044043

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/apiserver.go
File state/apiserver/apiserver.go (right):

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/apiserver....
state/apiserver/apiserver.go:102: return *err
On 2013/06/06 16:33:31, rog wrote:
> s/*err/err/

Done.

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/common/err...
File state/apiserver/common/errors.go (right):

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/common/err...
state/apiserver/common/errors.go:37: func ServerError(err error) *params.Error {
On 2013/06/06 16:33:31, rog wrote:
> // ServerError returns an error suitable
> // for returning to an API client, with
> // an error code suitable for various kinds
> // of errors generated in packages outside
> // the API.

Done.

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/common/int...
File state/apiserver/common/interfaces.go (right):

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/common/int...
state/apiserver/common/interfaces.go:20: RequireMachiner() error
On 2013/06/06 16:33:31, rog wrote:
> to fit in with the other methods, i'd be tempted to do this instead:
> 
> // AuthMachiner returns whether the authenticated entity
> // is a machine agent.
> AuthMachiner() bool

Done, but changed it to AuthMachineAgent as fwereade correctly suggested.

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/errors_tes...
File state/apiserver/errors_test.go (right):

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/errors_tes...
state/apiserver/errors_test.go:75: c.Assert(err1, NotNil)
On 2013/06/06 16:33:31, rog wrote:
> hmm, we should probably have a nil error test too. sorry i didn't notice/do
that
> before!

Done.

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/errors_tes...
state/apiserver/errors_test.go:80: c.Assert(err1.Error(), Equals, t.err.Error())
On 2013/06/06 16:33:31, rog wrote:
> we asserted that before.
> 
> i actually think that we can lose the if statement and do:
> c.Assert(err1.Message, Equals, t.err.Error())
> c.Assert(err1.Code, Equals, t.code)

Done.

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/root.go
File state/apiserver/root.go (right):

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/root.go#ne...
state/apiserver/root.go:61: // us making the check in every single request
method.
On 2013/06/06 16:33:31, rog wrote:
> if there's a place for this comment, it's on the Machiner method (or perhaps
on
> the root object).
> 
> i think this can just be:
> 
> // AuthMachiner returns whether the current client
> // is a machine agent.
> func (r *srvRoot) AuthMachiner() bool {
> }

Done.

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/root.go#ne...
state/apiserver/root.go:61: // us making the check in every single request
method.
On 2013/06/06 16:52:16, fwereade wrote:
> On 2013/06/06 16:33:31, rog wrote:
> > if there's a place for this comment, it's on the Machiner method (or perhaps
> on
> > the root object).
> > 
> > i think this can just be:
> > 
> > // AuthMachiner returns whether the current client
> > // is a machine agent.
> > func (r *srvRoot) AuthMachiner() bool {
> > }
> 
> AuthMachineAgent, please. Agents are not their tasks, and vice versa.

Done.

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/root.go#ne...
state/apiserver/root.go:86: 
On 2013/06/06 16:33:31, rog wrote:
> d

Done.

https://codereview.appspot.com/10044043/diff/30001/state/apiserver/root.go#ne...
state/apiserver/root.go:110: if id != "" {
On 2013/06/06 16:33:31, rog wrote:
> this check should come before the New call.
> 
> then you can just return machiner.New(r.srv.state, r),
> saving a few lines.

Done.
Sign in to reply to this message.

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