~1chb1n/charms/trusty/ceph-radosgw/next.normalize-makefile-test-deps

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/fetch/__init__.py

  • Committer: james.page at ubuntu
  • Date: 2014-10-06 22:16:05 UTC
  • mfrom: (26.1.5 ceph-radosgw)
  • Revision ID: james.page@ubuntu.com-20141006221605-z9wo0l6kj02s4onu
[coreycb,r=james-page] Add amulet tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
208
208
    """Add a package source to this system.
209
209
 
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
 
212
213
        ppa:charmers/example
213
214
        deb https://stub:key@private.example.com/ubuntu trusty main
214
215
 
311
312
        apt_update(fatal=True)
312
313
 
313
314
 
314
 
def install_remote(source):
 
315
def install_remote(source, *args, **kwargs):
315
316
    """
316
317
    Install a file tree from a remote source
317
318
 
318
319
    The specified source should be a url of the form:
319
320
        scheme://[host]/path[#[option=value][&...]]
320
321
 
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.
 
325
 
 
326
    For example::
 
327
 
 
328
        dest = install_remote('http://example.com/archive.tgz',
 
329
                              checksum='deadbeef',
 
330
                              hash_type='sha1')
 
331
 
 
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`.
 
336
    """
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:
328
342
        try:
329
 
            installed_to = handler.install(source)
 
343
            installed_to = handler.install(source, *args, **kwargs)
330
344
        except UnhandledSource:
331
345
            pass
332
346
    if not installed_to: