How to download/pull charms from charmhub?

Hi, I’m trying to download/pull a charm from the charmhub and I’m getting a bit confused.

Is charm-tools and charm pull still the only way to do this?

I was trying to download rev 19 of the ubuntu charm which is available in all the channels, however working with charm was not straight forward. It defaulted to referring to the charm store (cs:) and downloaded rev 18 unless ubuntu-19 was specified.

Am I doing something wrong?

P.S. charm still refers to the charm store.

$ charm version
charmstore-client 2.5.1
charm-tools 2.8.2

$ charm pull --help
Usage: charm pull [flags] <charm or bundle id> [--channel <channel>] [<directory>]

download a charm or bundle from the charm store

-B, --no-browser-login  (= false)
    do not use web browser for authentication
-a, --agent (= "")
    name of file containing agent login details
--auth  (= )
    user:passwd to use for basic HTTP authentication
-c, --channel  (= )
    the channel the charm or bundle is assigned to (stable|candidate|beta|edge|unpublished)

The pull command downloads a copy of a charm or bundle
from the charm store into a local directory.
If the directory is unspecified, the directory
will be named after the charm or bundle, so:

   charm pull trusty/wordpress

will fetch the wordpress charm into the
directory "wordpress" in the current directory.

To select a channel, use the --channel option, for instance:

        charm pull wordpress --channel edge
$ charm pull ubuntu

$ charm pull ch:ubuntu

$ charm pull ch:ubuntu --channel latest/stable
ERROR cannot get archive: Invalid channel: latest/stable

$ charm pull ch:ubuntu --channel stable

$ charm pull ch:ubuntu-19
1 Like

You can use juju to download charms from Charmhub.

juju download ubuntu --channel latest/stable --filepath ubuntu.charm

In case you’d like to modify the downloaded charm, you can unzip it.

unzip -q ubuntu.charm -d ubuntu/

Once your modifications are done, zip it back up.

cd ubuntu/ && zip -rq ../ubuntu.charm . && cd ..

This also works for bundles as well!

juju download charmed-kubernetes --channel 1.24/stable --filepath charmed-kubernetes-1.24-stable.bundle
unzip -q charmed-kubernetes-1.24-stable.bundle -d charmed-kubernetes-1.24-stable/

Hi Team,

How to download particular revision of charm using juju download option.

user@ACCESS:~$ juju download ceph-dashboard --base ubuntu@22.04 --channel latest/edge  --revision 41
ERROR option provided but not defined: --revision

user@ACCESS:~$ juju download ceph-dashboard --base ubuntu@22.04 --channel latest/edge
Fetching charm "ceph-dashboard" revision 44 using "latest/edge" channel and base "amd64/ubuntu/22.04"
Install the "ceph-dashboard" charm with:
    juju deploy ./ceph-dashboard_r44.charm