list resources will not work correctly

Bug #1569386 reported by Roger Peppe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Unassigned

Bug Description

This bug is in the gopkg.in/charmrepo.v2-unstable package, but affects
juju-core directly.

In Client.listResources in charmstore/client.go there's the following code:

    resmap, err := c.csWrapper.ListResources(ch.Channel, []*charm.URL{ch.URL})
    if err != nil {
       return nil, errors.Trace(err)
    }

    resources, ok := resmap[ch.URL.String()]
    if !ok {
        // no resources for that url, that's ok.
        return nil, nil
    }

The csWrapper.ListResources call invokes the csclient.Client.ListResources
method. This code is if there are some resources, the map returned by that
method will contain a single entry with the key ch.URL.String().

Unfortunately that's not the case, because the Client.ListResources
method removes the revision number from the URL before
making the actual HTTP API call, and the keys in the result map
will never contain the revision numbers.

So if ch.URL contains a revision number (which it will), Client.listResources will never
return any resources, which will mean the juju-core code won't
work correctly.

Changed in juju-core:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.0-rc1
tags: added: juju-release-support resources
Revision history for this message
Eric Snow (ericsnowcurrently) wrote :
Changed in juju-core:
status: Triaged → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
affects: juju-core → juju
Changed in juju:
milestone: 2.0-beta5 → none
milestone: none → 2.0-beta5
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.