Review Fix for @westurner and @thatch45 changes on dockerio doc

This commit is contained in:
Mathieu Le Marec - Pasquet 2013-12-22 14:49:04 +00:00
parent 2d9bcfdb56
commit 4702f9501c

View File

@ -4,7 +4,7 @@
Manage Docker containers Manage Docker containers
======================== ========================
`Docker <https://en.wikipedia.org/wiki/Docker_(software)>`_ `Docker <https://docker.io>`_
is a lightweight, portable, self-sufficient software container is a lightweight, portable, self-sufficient software container
wrapper. The base supported wrapper type is LXC: wrapper. The base supported wrapper type is LXC:
<https://en.wikipedia.org/wiki/Linux_Containers>`_, <https://en.wikipedia.org/wiki/Linux_Containers>`_,
@ -85,10 +85,19 @@ Available Functions
The docker modules are named `dockerio` because The docker modules are named `dockerio` because
the name 'docker' would conflict with the underlying docker-py library. the name 'docker' would conflict with the underlying docker-py library.
We should add magic to all methods to also match containers by name
now that the 'naming link' stuff has been merged in docker.
This applies for exemple to:
- running
- absent
- run
- script
''' '''
# Import python libs # Import python libs
import re
# Import salt libs # Import salt libs
from salt._compat import string_types from salt._compat import string_types
@ -117,9 +126,6 @@ def __virtual__():
INVALID_RESPONSE = 'We did not get an acceptable answer from docker' INVALID_RESPONSE = 'We did not get an acceptable answer from docker'
VALID_RESPONSE = '' VALID_RESPONSE = ''
NOTSET = object() NOTSET = object()
CONTAINER_GRAIN_ID = 'docker.containers.{id}.id'
CONTAINER_GRAIN_ID_RE = re.compile(
'docker.containers.([^.]+).id', re.S | re.M | re.U)
#Use a proxy mapping to allow queries & updates after the initial grain load #Use a proxy mapping to allow queries & updates after the initial grain load
MAPPING_CACHE = {} MAPPING_CACHE = {}
FN_CACHE = {} FN_CACHE = {}
@ -219,11 +225,14 @@ def pulled(name, force=False, *args, **kwargs):
.. note:: .. note::
The image must already be loaded in docker; see the See first the documentation for `docker login`, `docker pull`,
documentation for `docker login`, `docker pull`, `docker push`, `docker push`,
and `docker.import_image <https://github.com/dotcloud/docker-py#api>`_ and `docker.import_image <https://github.com/dotcloud/docker-py#api>`_
(`docker import (`docker import
<http://docs.docker.io/en/latest/commandline/cli/#import>`_). <http://docs.docker.io/en/latest/commandline/cli/#import>`_).
NOTE that We added saltack a way to identify yourself via pillar,
see in the salt.modules.dockerio execution module how to ident yourself
via the pillar.
name name
Tag of the image Tag of the image
@ -309,9 +318,6 @@ def installed(name,
image image
Image from which to build this container Image from which to build this container
path
Path in the filesystem to the dockerfile
environment environment
Environment variables for the container, either Environment variables for the container, either
- a mapping of key, values - a mapping of key, values
@ -323,19 +329,11 @@ def installed(name,
volumes volumes
List of volumes List of volumes
For other parameters, see the `docker-py documentation For other parameters, see absolutely first the salt.modules.dockerio
execution module and the docker-py python bindings for docker
documentation
<https://github.com/dotcloud/docker-py#api>`_ for <https://github.com/dotcloud/docker-py#api>`_ for
`docker.create_container` `docker.create_container`.
and the `docker CLI documentation
<http://docs.docker.io/en/latest/commandline/cli/#run>`_ for the
`docker run` command.
You can create it either by specifying :
- an image
- an absolute path on the filesystem
This mean that one of two parameters are required.
.. note:: .. note::
This command does not verify that the named container This command does not verify that the named container
@ -445,7 +443,7 @@ def present(name):
(`docker inspect`) (`docker inspect`)
name: name:
Either a `state_id` or container id container id
''' '''
ins_container = __salt('docker.inspect_container') ins_container = __salt('docker.inspect_container')
cinfos = ins_container(name) cinfos = ins_container(name)
@ -467,7 +465,6 @@ def run(name,
*args, **kwargs): *args, **kwargs):
'''Run a command in a specific container '''Run a command in a specific container
XXX: TODO: IMPLEMENT
You can match by either name or hostname You can match by either name or hostname
@ -617,6 +614,8 @@ def script(name,
''' '''
Run a command in a specific container Run a command in a specific container
XXX: TODO: IMPLEMENT
Matching can be done by either name or hostname Matching can be done by either name or hostname
name name
@ -638,10 +637,10 @@ def script(name,
Do not execute cmd if statement on the host return 0 Do not execute cmd if statement on the host return 0
docked_onlyif docked_onlyif
Same as onlyif but executed in the context of the docker Only execute cmd if statement in the container returns 0
docked_unless docked_unless
Same as unless but executed in the context of the docker Do not execute cmd if statement in the container returns 0
''' '''
if not hostname: if not hostname: