charmhelpers.fetch package¶
-
exception
charmhelpers.fetch.
AptLockError
¶ Bases:
Exception
-
class
charmhelpers.fetch.
BaseFetchHandler
¶ Bases:
object
Base class for FetchHandler implementations in fetch plugins
-
base_url
(url)¶ Return url without querystring or fragment
-
can_handle
(source)¶ Returns True if the source can be handled. Otherwise returns a string explaining why it cannot
-
install
(source)¶ Try to download and unpack the source. Return the path to the unpacked files or raise UnhandledSource.
-
parse_url
(url)¶
-
-
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: |
- “ppa:foo”
- “http://example.com/repo precise main”
- install_keys: |
- null
- “a1b2c3d4”
Note that ‘null’ (a.k.a. None) should not be quoted.
-
charmhelpers.fetch.
install_from_config
(config_var_name)¶ 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:
- scheme://[host]/path[#[option=value][&…]]
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('http://example.com/archive.tgz', checksum='deadbeef', hash_type='sha1')
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.core.host.ChecksumError
.
-
charmhelpers.fetch.
plugins
(fetch_handlers=None)¶