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

Issue 100460045: state/apiserver/*: use RegisterStandardFacade

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+219670, fwereade
Visibility:
Public.

Description

state/apiserver/*: use RegisterStandardFacade Lots of changes, mostly all mechanical. The items that aren't trivially mechanical are: 1) agent/agent.go wasn't taking a Resources, made it take one to be the same as the others. 2) common/registry_test.go This is the attempt to reintroduce the "no unknown methods" checks. It currently fails because we have to pass in id="" which isn't a known Id for the Watcher Facades. Otherwise it works just like the old one. I need to sort out what to do here. (add Watchers with id ""?) 3) state/apiserver/facades.go just imports all the types that used to be inlined in state/apiserver/root.go We could name it something else like "all", but we'll want a file like this somewhere, I think. 4) root.go MethodCaller implementation The biggest thing here is that the Client facade is not like the others. I have plans to clean that up, but that will be done in a different branch. 5) upgrader.go I probably shouldn't call this a fully special snowflake, because it isn't *as* special as Client is. But it is the only Facade that actually has 2 implementations, and which implementation gets returned is decided by the tagKind of the caller. It *is* special in that it doesn't use RegisterStandardFacade, though. 6) usermanager/usermanager.go also didn't take a Resources parameter. I'm leaving it for now to show off what bespoke func registries look like. I'll happily come back later to add Resources to NewUserManagerAPI and switch it to RegisterStandardFacade. 7) AllWatcher. I filed a bug about this, but we have no tests in the code base that the AllWatcher API facade actually exists. I believe we have coverage of the underlying MegaWatcher behavior. But since the juju CLI never used the AllWatcher, we don't even have a smoke test for things like "Clients can see the AllWatcher, but Agents cannot". I didn't improve that here, but hopefully I didn't screw up the auth semantics. 8) A bunch of the watchers were using direct methods from srvRoot, rather than the Authorizer + Resources paradigm. So I changed them from using "r.requireAgent() err" to using !isAgent(Authorizer) bool. Also, all of the new*Watcher functions fit FactoryFacade directly, because I had to write them anyway, and the don't fit RegisterStandardFacade (because they actually make use of the id parameter). There is clearly a *lot* of boilerplate between these functions, but AFAICT every other line uses a concrete type so it would be a lot of reflect work to have them share code. isAgent is also different now, instead of doing !Client, it does (Unit || Machine). Mostly because that lets us create an Authorizer which can do *anything*, whereas the negative logic means that something which is a Client and an Agent would sometimes not be an Agent. (Used in the "grab a copy of all facades and introspect them" test.) 9) isAgent helper changes from being something directly asking state to being a wrapper around the Authorizer code. And AuthClient changes from being !isAgent to just checking directly for whether this entity isUser. https://code.launchpad.net/~jameinel/juju-core/api-use-register-standard-facade/+merge/219670 Requires: https://code.launchpad.net/~jameinel/juju-core/api-register-standard-facade/+merge/219660 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state/apiserver/*: use RegisterStandardFacade #

Total comments: 6

Patch Set 3 : state/apiserver/*: use RegisterStandardFacade #

Patch Set 4 : state/apiserver/*: use RegisterStandardFacade #

Patch Set 5 : state/apiserver/*: use RegisterStandardFacade #

Patch Set 6 : state/apiserver/*: use RegisterStandardFacade #

Unified diffs Side-by-side diffs Delta from patch set Stats (+384 lines, -434 lines) Patch
A [revision details] View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M rpc/registry/registry.go View 1 2 3 4 5 2 chunks +4 lines, -1 line 0 comments Download
M rpc/server.go View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M state/apiserver/admin.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M state/apiserver/agent/agent.go View 2 chunks +5 lines, -1 line 0 comments Download
M state/apiserver/agent/agent_test.go View 6 chunks +11 lines, -4 lines 0 comments Download
M state/apiserver/charmrevisionupdater/updater.go View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M state/apiserver/client/client.go View 1 2 3 4 2 chunks +11 lines, -21 lines 0 comments Download
M state/apiserver/common/registry_test.go View 1 2 1 chunk +32 lines, -1 line 0 comments Download
M state/apiserver/deployer/deployer.go View 1 chunk +4 lines, -0 lines 0 comments Download
M state/apiserver/environment/environment.go View 1 chunk +4 lines, -0 lines 0 comments Download
A state/apiserver/facades.go View 1 2 3 4 1 chunk +23 lines, -0 lines 0 comments Download
M state/apiserver/firewaller/firewaller.go View 1 chunk +4 lines, -0 lines 0 comments Download
M state/apiserver/keymanager/keymanager.go View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M state/apiserver/keyupdater/authorisedkeys.go View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M state/apiserver/logger/logger.go View 1 chunk +4 lines, -0 lines 0 comments Download
M state/apiserver/machine/machiner.go View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
A state/apiserver/pinger.go View 1 2 3 4 1 chunk +103 lines, -0 lines 0 comments Download
M state/apiserver/provisioner/provisioner.go View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M state/apiserver/root.go View 1 2 3 4 5 6 chunks +23 lines, -362 lines 0 comments Download
M state/apiserver/root_test.go View 1 2 3 4 1 chunk +0 lines, -31 lines 0 comments Download
M state/apiserver/rsyslog/rsyslog.go View 1 chunk +4 lines, -0 lines 0 comments Download
M state/apiserver/uniter/uniter.go View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M state/apiserver/upgrader/upgrader.go View 1 2 3 4 5 2 chunks +29 lines, -0 lines 0 comments Download
M state/apiserver/usermanager/usermanager.go View 1 chunk +12 lines, -0 lines 0 comments Download
M state/apiserver/utils.go View 1 chunk +0 lines, -6 lines 0 comments Download
M state/apiserver/watcher.go View 1 2 3 4 4 chunks +83 lines, -5 lines 0 comments Download

Messages

Total messages: 10
jameinel
Please take a look.
9 years, 11 months ago (2014-05-15 09:42:41 UTC) #1
jameinel
Please take a look.
9 years, 11 months ago (2014-05-15 09:47:15 UTC) #2
fwereade
On 2014/05/15 09:47:15, jameinel wrote: > Please take a look. 2) I'm not really sure ...
9 years, 11 months ago (2014-05-16 10:57:15 UTC) #3
fwereade
https://codereview.appspot.com/100460045/diff/20001/state/apiserver/common/registry_test.go File state/apiserver/common/registry_test.go (right): https://codereview.appspot.com/100460045/diff/20001/state/apiserver/common/registry_test.go#newcode198 state/apiserver/common/registry_test.go:198: // Entity ? Entity skipped because no facade is ...
9 years, 11 months ago (2014-05-16 10:57:24 UTC) #4
jameinel
Please take a look.
9 years, 11 months ago (2014-05-17 04:57:45 UTC) #5
jameinel
Please take a look.
9 years, 11 months ago (2014-05-20 11:09:32 UTC) #6
jameinel
Please take a look.
9 years, 11 months ago (2014-05-22 11:26:42 UTC) #7
jameinel
On 2014/05/16 10:57:15, fwereade wrote: > On 2014/05/15 09:47:15, jameinel wrote: > > Please take ...
9 years, 11 months ago (2014-05-22 11:47:15 UTC) #8
jameinel
Please take a look. https://codereview.appspot.com/100460045/diff/20001/state/apiserver/common/registry_test.go File state/apiserver/common/registry_test.go (right): https://codereview.appspot.com/100460045/diff/20001/state/apiserver/common/registry_test.go#newcode198 state/apiserver/common/registry_test.go:198: // Entity ? On 2014/05/16 ...
9 years, 11 months ago (2014-05-22 11:58:04 UTC) #9
fwereade
9 years, 11 months ago (2014-05-27 09:02:51 UTC) #10
LGTM, thanks
Sign in to reply to this message.

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