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

Issue 8926043: Add upgrade-charm to the API

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years ago by matthew.scott
Modified:
11 years ago
Reviewers:
bac, dimitern, mp+160469, rog
Visibility:
Public.

Description

Add upgrade-charm to the API Per #1100904, we need to be able to upgrade a charm from the API for the GUI. This adds the upgradecharm command to the statecmds. https://code.launchpad.net/~makyo/juju-core/upgrade-charm-api-1171548/+merge/160469 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 18

Patch Set 2 : Add upgrade-charm to the API #

Unified diffs Side-by-side diffs Delta from patch set Stats (+157 lines, -32 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/upgradecharm.go View 2 chunks +11 lines, -32 lines 0 comments Download
M state/api/apiclient.go View 1 1 chunk +10 lines, -0 lines 0 comments Download
M state/api/params/params.go View 1 chunk +7 lines, -0 lines 0 comments Download
M state/apiserver/api_test.go View 1 2 chunks +16 lines, -0 lines 0 comments Download
M state/apiserver/apiserver.go View 1 1 chunk +5 lines, -0 lines 0 comments Download
A state/statecmd/upgradecharm.go View 1 chunk +50 lines, -0 lines 0 comments Download
A state/statecmd/upgradecharm_test.go View 1 1 chunk +56 lines, -0 lines 0 comments Download

Messages

Total messages: 8
matthew.scott
Please take a look.
11 years ago (2013-04-23 18:35:06 UTC) #1
dimitern
Looks good, just some suggestions. https://codereview.appspot.com/8926043/diff/1/state/api/apiclient.go File state/api/apiclient.go (right): https://codereview.appspot.com/8926043/diff/1/state/api/apiclient.go#newcode88 state/api/apiclient.go:88: // ServiceUpgradeCharm upgrades the ...
11 years ago (2013-04-24 08:11:17 UTC) #2
bac
LGTM with Dimitern's changes. https://codereview.appspot.com/8926043/diff/1/state/apiserver/api_test.go File state/apiserver/api_test.go (right): https://codereview.appspot.com/8926043/diff/1/state/apiserver/api_test.go#newcode437 state/apiserver/api_test.go:437: // signatures match. Why did ...
11 years ago (2013-04-24 14:08:29 UTC) #3
matthew.scott
Thanks for the reviews. https://codereview.appspot.com/8926043/diff/1/state/api/apiclient.go File state/api/apiclient.go (right): https://codereview.appspot.com/8926043/diff/1/state/api/apiclient.go#newcode88 state/api/apiclient.go:88: // ServiceUpgradeCharm upgrades the service's ...
11 years ago (2013-04-24 15:18:53 UTC) #4
dimitern
Thanks, LGTM.
11 years ago (2013-04-24 15:51:46 UTC) #5
fwereade
Tests need to move to the right place as well, not just the code ;). ...
11 years ago (2013-04-24 16:24:39 UTC) #6
matthew.scott
*** Submitted: Add upgrade-charm to the API Per #1100904, we need to be able to ...
11 years ago (2013-04-24 16:46:31 UTC) #7
rog
11 years ago (2013-04-24 16:51:11 UTC) #8
This is going in a good direction, but I think there's some more work to be done
with respect to local charms. I've made some comments below; until that issue is
addressed, this does not LGTM.

https://codereview.appspot.com/8926043/diff/1/cmd/juju/upgradecharm.go
File cmd/juju/upgradecharm.go (right):

https://codereview.appspot.com/8926043/diff/1/cmd/juju/upgradecharm.go#newcode87
cmd/juju/upgradecharm.go:87: err = statecmd.ServiceUpgradeCharm(conn.State,
params)
s/err = /return/
?

https://codereview.appspot.com/8926043/diff/1/state/api/params/params.go
File state/api/params/params.go (right):

https://codereview.appspot.com/8926043/diff/1/state/api/params/params.go#newc...
state/api/params/params.go:81: RepoPath    string // defaults to JUJU_REPOSITORY
i'm not sure that defaulting to JUJU_REPOSITORY is correct here - the API server
won't have a sensible JUJU_REPOSITORY set, will it?

https://codereview.appspot.com/8926043/diff/1/state/apiserver/api_test.go
File state/apiserver/api_test.go (right):

https://codereview.appspot.com/8926043/diff/1/state/apiserver/api_test.go#new...
state/apiserver/api_test.go:428: err :=
st.Client().ServiceUpgradeCharm("no-such", false, "")
i think we're missing a test - the op* functions are to test permissions only.
i'd like to a see an independent test that tests the ServiceUpgradeCharm
functionality specifically.
given that there are already tests in statecmd, just something minimal will do
until the code and tests moves from statecmd to apiserver.

https://codereview.appspot.com/8926043/diff/1/state/apiserver/api_test.go#new...
state/apiserver/api_test.go:436: // This test only checks that the call is made
without error, ensuring the
s/ensuring the signatures match/ensuring the correct permission check is made/
?

https://codereview.appspot.com/8926043/diff/1/state/apiserver/api_test.go#new...
state/apiserver/api_test.go:437: // signatures match.
On 2013/04/24 14:08:29, bac wrote:
> Why did you add this comment here and not in your new function?

i'd be happy if the comment is added to all similar places.

https://codereview.appspot.com/8926043/diff/1/state/statecmd/upgradecharm.go
File state/statecmd/upgradecharm.go (right):

https://codereview.appspot.com/8926043/diff/1/state/statecmd/upgradecharm.go#...
state/statecmd/upgradecharm.go:15: conn, err := juju.NewConnFromState(state)
better would be to have the Conn as an argument - cmd/juju already has one
around.

https://codereview.appspot.com/8926043/diff/1/state/statecmd/upgradecharm.go#...
state/statecmd/upgradecharm.go:24: repo, err := charm.InferRepository(curl,
args.RepoPath)
i'm not sure that this logic is right when running in the API server, where we
never want to allow local charms AFAICS.

i wonder if the charm repository should be an extra argument to
ServiceUpgradeCharm; then the API can always pass charm.Store, and the cmd/juju
code can call InferRepository.

the api entry point should check for and reject charm urls with a local schema
(in the future it will probably use a separate entry point for uploading
charms).

I'd take all local-specific stuff out of this function and leave it in cmd/juju.
Sign in to reply to this message.

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