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

Issue 43860043: state/api: AddCharm implemented (Closed)

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

Description

state/api: AddCharm implemented This compliments the AddLocalCharm landed previously, by supporting charm store (non-local really) charms. AddCharm is a bit simpler than AddLocalCharm in that it does not need to do a prepare + upload + update, because the charm store is trusted to provide unique revisions. https://code.launchpad.net/~dimitern/juju-core/226-addcharm-api/+merge/199478 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state/api: AddCharm implemented #

Total comments: 13

Patch Set 3 : state/api: AddCharm implemented #

Total comments: 6

Patch Set 4 : state/api: AddCharm implemented #

Unified diffs Side-by-side diffs Delta from patch set Stats (+156 lines, -1 line) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/client.go View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M state/apiserver/client/client.go View 1 2 3 2 chunks +81 lines, -0 lines 0 comments Download
M state/apiserver/client/client_test.go View 1 2 3 3 chunks +64 lines, -1 line 0 comments Download

Messages

Total messages: 7
dimitern
Please take a look.
10 years, 4 months ago (2013-12-18 15:29:27 UTC) #1
dimitern
Please take a look.
10 years, 4 months ago (2013-12-18 16:19:24 UTC) #2
natefinch
few small tweaks https://codereview.appspot.com/43860043/diff/20001/state/apiserver/client/client.go File state/apiserver/client/client.go (right): https://codereview.appspot.com/43860043/diff/20001/state/apiserver/client/client.go#newcode865 state/apiserver/client/client.go:865: // if it does not exists ...
10 years, 4 months ago (2013-12-18 17:22:07 UTC) #3
rog
Looks really good in general. A few suggestions below. https://codereview.appspot.com/43860043/diff/20001/state/api/client.go File state/api/client.go (right): https://codereview.appspot.com/43860043/diff/20001/state/api/client.go#newcode448 state/api/client.go:448: ...
10 years, 4 months ago (2013-12-18 18:35:38 UTC) #4
dimitern
Please take a look. https://codereview.appspot.com/43860043/diff/20001/state/api/client.go File state/api/client.go (right): https://codereview.appspot.com/43860043/diff/20001/state/api/client.go#newcode448 state/api/client.go:448: if curl == nil { ...
10 years, 4 months ago (2013-12-19 08:47:34 UTC) #5
rog
LGTM modulo the below. I don't think we should mind about making changes to the ...
10 years, 4 months ago (2013-12-19 09:10:22 UTC) #6
dimitern
10 years, 4 months ago (2013-12-19 09:58:05 UTC) #7
Please take a look.

https://codereview.appspot.com/43860043/diff/40001/state/apiserver/client/cli...
File state/apiserver/client/client.go (right):

https://codereview.appspot.com/43860043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client.go:875: if charmURL.Schema == "local" {
On 2013/12/19 09:10:22, rog wrote:
> Given that we're using CharmStore below, this should probably be :
> 
> if charmURL.Schema != "cs" {
>     return fmt.Errorf("AddCharm only supports charmstore charms")
> }

Done.

https://codereview.appspot.com/43860043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client.go:899: archive, err :=
os.Open(downloadedCharm.(*charm.Bundle).Path)
On 2013/12/19 09:10:22, rog wrote:
> This type assertion should probably be checked rather than panicking.

Done, although there's no way this can happen currently.

https://codereview.appspot.com/43860043/diff/40001/state/apiserver/client/cli...
state/apiserver/client/client.go:905: size, err := io.Copy(hash, archive)
On 2013/12/19 09:10:22, rog wrote:
> For the record, this hash is already calculated (and used) in the charm
package
> - there's no need to spread the logic around or to iterate through the 
contents
> once more. I don't think this adds to the generality of the logic - it just
> makes things a little more complex and a little more inefficient.

Noted, we can change it later, if needed.
Sign in to reply to this message.

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