Merge lp://qastaging/~johnsca/charm-helpers/docker into lp://qastaging/charm-helpers
Proposed by
Cory Johns
Status: | Needs review |
---|---|
Proposed branch: | lp://qastaging/~johnsca/charm-helpers/docker |
Merge into: | lp://qastaging/charm-helpers |
Diff against target: |
627 lines (+552/-1) 7 files modified
charmhelpers/contrib/docker/__init__.py (+287/-0) charmhelpers/core/host.py (+5/-0) charmhelpers/core/services/base.py (+14/-1) docs/api/charmhelpers.contrib.docker.rst (+8/-0) docs/api/charmhelpers.contrib.rst (+1/-0) docs/examples/docker.rst (+119/-0) tests/contrib/docker/test_docker.py (+118/-0) |
To merge this branch: | bzr merge lp://qastaging/~johnsca/charm-helpers/docker |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
amir sanjar (community) | Approve | ||
Benjamin Saller (community) | Approve | ||
charmers | Pending | ||
Charm Helper Maintainers | Pending | ||
Review via email: mp+231226@code.qastaging.launchpad.net |
Description of the change
Added helpers for managing Docker containers in a charm, using the services framework. Includes documentation.
To post a comment you must log in.
Unmerged revisions
- 195. By Cory Johns
-
Added Docker helpers and documentation
i'd also appreciate an option for docker install latest ala /docs.docker. com/installatio n/binaries/
https:/
On Mon, Aug 18, 2014 at 12:29 PM, Cory Johns <email address hidden>
wrote:
> Cory Johns has proposed merging lp:~johnsca/charm-helpers/docker into /code.launchpad .net/~johnsca/ charm-helpers/ docker/ +merge/ 231226 /code.launchpad .net/~johnsca/ charm-helpers/ docker/ +merge/ 231226 contrib/ docker' contrib/ docker/ __init_ _.py' contrib/ docker/ __init_ _.py 1970-01-01 00:00:00 +0000 contrib/ docker/ __init_ _.py 2014-08-18 16:28:55 +0000 core.services. base import ManagerCallback core.services. helpers import RelationContext install( ['docker. io']) exists( '/usr/local/ bin/docker' ): '/usr/local/ bin/docker' ) '/usr/bin/ docker. io', '/usr/local/ bin/docker' ) etc/bash_ completion. d/docker. io', 'a') as fp: '\ncomplete -F _docker docker') docker_ unstable( ): source( 'deb https:/ /get.docker. io/ubuntu docker main', 45C8950F966E92D 8576A8BA88D21E9 ') update( fatal=True) install( ['lxc-docker' ]) pull(container_ name, registry=None, username=None, check_call( [ check_call( ['docker' , 'pull', container_name]) ManagerCallback ): `DockerPortMapp ings`, :class: `DockerVolumes` ,
> lp:charm-helpers.
>
> Requested reviews:
> Charm Helper Maintainers (charm-helpers)
>
> For more details, see:
> https:/
>
> Added helpers for managing Docker containers in a charm, using the
> services framework. Includes documentation.
> --
> https:/
> Your team Charm Helper Maintainers is requested to review the proposed
> merge of lp:~johnsca/charm-helpers/docker into lp:charm-helpers.
>
> === added directory 'charmhelpers/
> === added file 'charmhelpers/
> --- charmhelpers/
> +++ charmhelpers/
> @@ -0,0 +1,287 @@
> +
> +import os
> +import subprocess
> +
> +from charmhelpers import fetch
> +from charmhelpers.core import host
> +from charmhelpers.core import hookenv
> +from charmhelpers.
> +from charmhelpers.
> +
> +
> +def install_docker():
> + """
> + Install the Docker tools.
> + """
> + fetch.apt_
> + if os.path.
> + os.unlink(
> + os.symlink(
> + with open('/
> + fp.write(
> +
> +
> +def install_
> + """
> + Install the Docker tools from the unstable (but potentially more
> + up-to-date) repository.
> + """
> + fetch.add_
> + key='36A1D78692
> + fetch.apt_
> + fetch.apt_
> +
> +
> +def docker_
> password=None):
> + """
> + Fetch a container from the Docker registry.
> +
> + If :param:`registry` is given, the container will be pulled from that
> + registry instead of the default. If the registry requires
> authentication,
> + provide the :param:`username` and :param:`password` arguments.
> + """
> + if registry is not None:
> + container_name = '/'.join([registry, container_name])
> + if any(username, password):
> + subprocess.
> + 'docker', 'login', '-u', username, '-p', password])
> + subprocess.
> +
> +
> +class DockerCallback(
> + """
> + ServiceManager callback to manage starting up a Docker container.
> +
> + Can be referenced as ``docker_start`` or ``docker_stop``, and performs
> + the appropriate action. Requires one or more of
> + :class:
> + :c...