208
208
"""Add a package source to this system.
210
210
@param source: a URL or sources.list entry, as supported by
211
add-apt-repository(1). Examples:
211
add-apt-repository(1). Examples::
212
213
ppa:charmers/example
213
214
deb https://stub:key@private.example.com/ubuntu trusty main
311
312
apt_update(fatal=True)
314
def install_remote(source):
315
def install_remote(source, *args, **kwargs):
316
317
Install a file tree from a remote source
318
319
The specified source should be a url of the form:
319
320
scheme://[host]/path[#[option=value][&...]]
321
Schemes supported are based on this modules submodules
322
Options supported are submodule-specific"""
322
Schemes supported are based on this modules submodules.
323
Options supported are submodule-specific.
324
Additional arguments are passed through to the submodule.
328
dest = install_remote('http://example.com/archive.tgz',
332
This will download `archive.tgz`, validate it using SHA1 and, if
333
the file is ok, extract it and return the directory in which it
334
was extracted. If the checksum fails, it will raise
335
:class:`charmhelpers.core.host.ChecksumError`.
323
337
# We ONLY check for True here because can_handle may return a string
324
338
# explaining why it can't handle a given source.
325
339
handlers = [h for h in plugins() if h.can_handle(source) is True]
326
340
installed_to = None
327
341
for handler in handlers:
329
installed_to = handler.install(source)
343
installed_to = handler.install(source, *args, **kwargs)
330
344
except UnhandledSource:
332
346
if not installed_to: