charmhelpers.fetch package

exception charmhelpers.fetch.AptLockError

Bases: Exception

class charmhelpers.fetch.BaseFetchHandler

Bases: object

Base class for FetchHandler implementations in fetch plugins


Return url without querystring or fragment


Returns True if the source can be handled. Otherwise returns a string explaining why it cannot


Try to download and unpack the source. Return the path to the unpacked files or raise UnhandledSource.

exception charmhelpers.fetch.GPGKeyError

Bases: Exception

Exception occurs when a GPG key cannot be fetched or used. The message indicates what the problem is.

exception charmhelpers.fetch.SourceConfigError

Bases: Exception

exception charmhelpers.fetch.UnhandledSource

Bases: Exception

charmhelpers.fetch.configure_sources(update=False, sources_var='install_sources', keys_var='install_keys')

Configure multiple sources from charm configuration.

The lists are encoded as yaml fragments in the configuration. The fragment needs to be included as a string. Sources and their corresponding keys are of the types supported by add_source().

Example config:
install_sources: |
install_keys: |
  • null
  • “a1b2c3d4”

Note that ‘null’ (a.k.a. None) should not be quoted.


Install a file from config.

charmhelpers.fetch.install_remote(source, *args, **kwargs)

Install a file tree from a remote source.

The specified source should be a url of the form:

Schemes supported are based on this modules submodules. Options supported are submodule-specific. Additional arguments are passed through to the submodule.

For example:

dest = install_remote('',

This will download archive.tgz, validate it using SHA1 and, if the file is ok, extract it and return the directory in which it was extracted. If the checksum fails, it will raise


charmhelpers.fetch.archiveurl module

charmhelpers.fetch.bzrurl module

charmhelpers.fetch.snap module

charmhelpers.fetch.python module