Comment 4 for bug 2031665

Revision history for this message
Heather Lanigan (hmlanigan) wrote : Re: Juju finds incorrect charm revision on Charmhub

@manadart

When juju queries charm hub for list of bases in general, an architecture is required. However when you ask for a charm revision, it's implied that you know what base (os/version/arch) you are getting, however juju does not validate that.

curl -s https://api.snapcraft.io/v2/charms/refresh -H 'Content-type: application/json' -d '{"context":[],"actions":[{"action":"install","instance-key":"0c13a624-1b03-485c-860f-38dad01566fe","name":"grafana","revision":66,"base":null}],"fields":["bases","config-yaml","download","id","license","metadata-yaml","name","publisher","resources","revision","summary","type","version"]}' | jq .
...
      "charm": {
        "bases": [
          {
            "architecture": "amd64",
            "channel": "20.04",
            "name": "ubuntu"
          }
        ],
...

Juju didn't validate the actual architecture of LXD vs the architecture specified with revision 66, I'd guess and deployed anyways. However the saved base had the actual juju machine architecture, thus refresh found the correct revision of 51 based on a base of arm64/ubuntu/20.04.

The refresh request is correct per juju/charmhub. The initial deploy should have been failed.

The Charmhub API really isn't designed for deploy by revision.