Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Extract resources apiserver parts into the apiserver package #7123
Conversation
mjs
added some commits
Mar 8, 2017
wallyworld
approved these changes
Mar 20, 2017
Looks pretty nice. So good to get this cleaned up.
Not sure if we want to test with a 2.0 client just to be sure.
| @@ -475,7 +509,7 @@ func (srv *Server) endpoints() []apihttp.Endpoint { | ||
| }, | ||
| ) | ||
| add("/migrate/resources", | ||
| - &resourceUploadHandler{ | ||
| + &resourceMigUploadHandler{ |
wallyworld
Mar 20, 2017
Owner
I'd love to see "Mig" replaced with the full name rather than the abbreviation.
I thought of a jet fighter and took me a second to realise what it really was
| - "github.com/juju/juju/apiserver/params" | ||
| - "github.com/juju/juju/resource/api" | ||
| -) | ||
| +package params | ||
| // ListResourcesArgs holds the arguments for an API request to list |
| newCharmstoreClient func() (CharmStore, error) | ||
| } | ||
| -// NewFacade returns a new resoures facade for the given Juju state. | ||
| -func NewFacade(store DataStore, newClient func() (CharmStore, error)) (*Facade, error) { | ||
| +// NewPublicFacade creates apublic API facade for resources. It is |
| +} | ||
| + | ||
| +// NewFacade returns a new resoures API facade. | ||
| +func NewFacade(store backend, newClient func() (CharmStore, error)) (*Facade, error) { |
| @@ -293,24 +292,24 @@ func (s *AddPendingResourcesSuite) TestWithURLUpload(c *gc.C) { | ||
| //func (s *AddPendingResourcesSuite) TestUnknownResource(c *gc.C) { |
wallyworld
Mar 20, 2017
Owner
Not sure why this was originally commented out.
We should either skip with a bug and a todo, or delete.
mjs
Mar 20, 2017
Contributor
Not sure what the background here is but it looks like one of the other (enabled) tests already covers this.
| @@ -0,0 +1,164 @@ | ||
| +// Copyright 2016 Canonical Ltd. |
| +// | ||
| +// TODO(mjs): This is the entry point for a whole lot of untested shim | ||
| +// code in this package. At some point this should be sorted out. | ||
| +func NewResourceOpener(st *corestate.State, unitName string) (opener resource.Opener, err error) { |
wallyworld
Mar 20, 2017
Owner
Can you add a comment that the caller is responsible for closing state just be make it explicit.
I traced to code to be sure we weren't leaking connections, so would be nice to inform the reader the expectation.
mjs
added some commits
Mar 20, 2017
|
$$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 |
|
Build failed: Tests failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$mongodb-died$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
mjs commentedMar 20, 2017
Description of change
This PR is part of the cleanup of the apiserver facade registration. All the resources related apiserver code has been moved to the apiserver package, include HTTP endpoints. This means that resources related APIs are now defined in the same way as all other APIs.
Some highlights:
This PR results in a net removal of over 1700 lines of code, for no functional change!
QA steps
Documentation changes
No user visible effects.
Bug reference
N.A.