Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Stub out the meta endpoint for resources. #563
Conversation
|
Test FAILed. |
ericsnowcurrently
added some commits
Mar 1, 2016
|
Test FAILed. |
|
Note that the test failure is due to a pending dep change: juju/charmrepo#67. |
|
Test FAILed. |
natefinch
reviewed
Mar 8, 2016
| + description: get things started | ||
| + for-upload: | ||
| + Type: file | ||
| + filename: config.xml |
natefinch
reviewed
Mar 8, 2016
| + | ||
| + var resources []resource.Resource | ||
| + for _, meta := range entity.CharmMeta.Resources { | ||
| + // We use an origin of "upload" since charms cannot be uploaded yet. |
natefinch
reviewed
Mar 8, 2016
| gopkg.in/juju/charmrepo.v2-unstable git f03e1b601c98ff4a97baeedac856a7a030e021f4 2016-01-11T16:59:27Z | ||
| -gopkg.in/juju/jujusvg.v1 git a60359df348ef2ca40ec3bcd58a01de54f05658e 2016-02-11T20:24:49Z | ||
| +gopkg.in/juju/jujusvg.v1 git a60359df348ef2ca40ec3bcd58a01de54f05658e 2016-02-11T10:02:50Z |
natefinch
Mar 8, 2016
this appears to be moving this repo to an earlier revision... that seems wrong.
natefinch
commented
Mar 8, 2016
|
LGTM aside from some small things. |
mhilton
reviewed
Mar 8, 2016
| @@ -235,6 +235,7 @@ func RouterHandlers(h *ReqHandler) *router.Handlers { | ||
| "perm": h.puttableBaseEntityHandler(h.metaPerm, h.putMetaPerm, "acls", "developmentacls"), | ||
| "perm/": h.puttableBaseEntityHandler(h.metaPermWithKey, h.putMetaPermWithKey, "acls", "developmentacls"), | ||
| "promulgated": h.baseEntityHandler(h.metaPromulgated, "promulgated"), | ||
| + "resources": h.EntityHandler(h.metaResources, "_id", "charmmeta"), |
ericsnowcurrently
Mar 8, 2016
Contributor
We use Entity.URL (which is _id in the doc). Do you mean that's always filled in? I noticed that most of the other handlers require _id.
ericsnowcurrently
Mar 8, 2016
Contributor
This line is strictly for meta-get. The doc comment below relates to the non-meta endpoint (which incidentally does not actually handle PUT).
frankban
Mar 9, 2016
Member
IIRC _id is only strictly required when no other fields are required, so that not all fields are retrieved.
mhilton
reviewed
Mar 8, 2016
| @@ -1357,6 +1346,11 @@ func (h *ReqHandler) servePublish(id *charm.URL, w http.ResponseWriter, req *htt | ||
| return errgo.Mask(err, errgo.Any) | ||
| } | ||
| + // TODO(ericsnow) Actually handle the resources. | ||
| + if len(publish.Resources) > 0 { |
|
Test FAILed. |
mhilton
reviewed
Mar 8, 2016
| + switch req.Method { | ||
| + case "GET": | ||
| + return h.serveDownloadResource(id, w, req) | ||
| + case "POST": |
mhilton
Mar 8, 2016
Member
meta endpoints currently don't allow POST. You might have to look at the how the router works to enable it.
frankban
reviewed
Mar 9, 2016
| + exclusive: charmOnly, | ||
| + checkURL: newResolvedURL("cs:~charmers/utopic/starsay-17", 17), | ||
| + assertCheckData: func(c *gc.C, data interface{}) { | ||
| + //resources := data.([]params.Resource) |
frankban
reviewed
Mar 9, 2016
| + | ||
| +func basicListResources(entity *mongodoc.Entity) ([]resource.Resource, error) { | ||
| + if entity.URL.Series == "bundle" { | ||
| + return nil, errgo.Newf("bundles do not have resources") |
|
|
ericsnowcurrently
added some commits
Mar 9, 2016
|
Test FAILed. |
|
Re-submitting against the new-channels-model branch. |
ericsnowcurrently commentedMar 7, 2016
The full implementation of the resources endpoints will be added later, after channels land.