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

Issue 67750045: Implement the get charm file API.

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

Description

Implement the get charm file API. Add to the HTTPS API server the ability to serve local charm files. As discussed with Rick and Dimiter if the query includes the file, then the file contents are served. If file points to a directory an error is returned. If the query does not include a file, then a JSON response is sent including a list of charm files. QA: - Download the Ghost charm from https://github.com/hatched/ghost-charm (the zip archive can be downloaded from the sidebar on the right). - Bootstrap a local environment using this branch. - Upload the ghost local charm, e.g.: `curl -ikL --data-binary @/path/to/ghost-charm-master.zip -H "Content-Type: application/zip" https://user-admin:MYPASSWD@10.0.3.1:17070/charms?series=precise`. The response should be something like: {"CharmURL":"local:precise/ghost-4"}. - Download ghost charm files, e.g.: `curl -ikLG -d "url=local:precise/ghost-4&file=icon.svg" https://user-admin:MYPASSWD@10.0.3.1:17070/charms` or `curl -ikLG -d "url=local:precise/ghost-4&file=hooks/install" https://user-admin:MYPASSWD@10.0.3.1:17070/charms`: you should see the file contents. - Ensure directories are not allowed, e.g.: `curl -ikLG -d "url=local:precise/ghost-4&file=hooks" https://user-admin:MYPASSWD@10.0.3.1:17070/charms`: you should see a 403 forbidden. - Retrieve a list of the charm files: `curl -ikLG -d "url=local:precise/ghost-4" https://user-admin:MYPASSWD@10.0.3.1:17070/charms`. - Done, destroy the environment, thank you! https://code.launchpad.net/~frankban/juju-core/get-charm-api/+merge/207994 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 5

Patch Set 2 : Implement the get charm file API. #

Total comments: 25

Patch Set 3 : Implement the get charm file API. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+358 lines, -30 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/params/internal.go View 1 1 chunk +4 lines, -3 lines 0 comments Download
M state/apiserver/apiserver.go View 1 chunk +1 line, -1 line 0 comments Download
M state/apiserver/charms.go View 1 2 7 chunks +168 lines, -3 lines 0 comments Download
M state/apiserver/charms_test.go View 1 2 9 chunks +183 lines, -23 lines 0 comments Download

Messages

Total messages: 8
frankban
Please take a look.
10 years, 2 months ago (2014-02-24 18:39:03 UTC) #1
dimitern
LGTM, thanks for doing this! https://codereview.appspot.com/67750045/diff/1/state/api/params/internal.go File state/api/params/internal.go (right): https://codereview.appspot.com/67750045/diff/1/state/api/params/internal.go#newcode509 state/api/params/internal.go:509: // CharmsResponse is the ...
10 years, 2 months ago (2014-02-25 10:07:09 UTC) #2
dimitern
On second though and after discussion with the team on today's standup, some changes are ...
10 years, 2 months ago (2014-02-25 12:04:02 UTC) #3
frankban
Please take a look. https://codereview.appspot.com/67750045/diff/1/state/api/params/internal.go File state/api/params/internal.go (right): https://codereview.appspot.com/67750045/diff/1/state/api/params/internal.go#newcode509 state/api/params/internal.go:509: // CharmsResponse is the server ...
10 years, 2 months ago (2014-02-25 17:03:52 UTC) #4
dimitern
Much better, thanks! LGTM with just a few formatting suggestions below. Make sure you've run ...
10 years, 2 months ago (2014-02-25 17:40:02 UTC) #5
frankban
Please take a look. https://codereview.appspot.com/67750045/diff/20001/state/apiserver/charms.go File state/apiserver/charms.go (right): https://codereview.appspot.com/67750045/diff/20001/state/apiserver/charms.go#newcode125 state/apiserver/charms.go:125: for _, file := range ...
10 years, 2 months ago (2014-02-26 09:34:28 UTC) #6
frankban
Thank you!
10 years, 2 months ago (2014-02-26 09:35:30 UTC) #7
dimitern
10 years, 2 months ago (2014-02-26 10:01:02 UTC) #8
https://codereview.appspot.com/67750045/diff/20001/state/apiserver/charms.go
File state/apiserver/charms.go (right):

https://codereview.appspot.com/67750045/diff/20001/state/apiserver/charms.go#...
state/apiserver/charms.go:138: } else {
On 2014/02/26 09:34:28, frankban wrote:
> On 2014/02/25 17:40:03, dimitern wrote:
> > Instead of else, you could just return in the if block above.
> 
> We need contents in the scope, that's why I used else.

Then you can just move the assignment out of the if.
Sign in to reply to this message.

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