%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/dockermod.pyo

�
���^c@@s�	dZddlmZdZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlmZmZddlmZddlmZddlZddlZddlZddlZddl Zddl!ZddlZddl"Zddl#m$Z$ddl%Zyddl&Z&e'Z(Wne)k
r�e*Z(nXy1ej+r�ddl,j-Z-nddl-Z-e'Z.Wne)k
re*Z.nXyddl/Z/e'Z0Wne)k
r8e*Z0nXe1ej2j3j4d	��Z5e
j6e7�Z8id
d6dd
6dd6dd6dd6dd6dd6Z9dddfZ:dddfZ;dZ<e=�Z>dZ?ddfZ@dgZAidd 6dd6dd6ZBd!�ZCd"e	jDfd#��YZEd$�ZFe>d%�ZGd&�ZHd'�ZId(�ZJd)�ZKd*�ZLd+�ZMd,�ZNd-�ZOePd.�ZQd/�ZRd0�ZSd1�ZTd2�ZUeId3��ZVd4�ZWd5�ZXd6�ZYd7�ZZd8�Z[ePd9�Z\ePe*e'ePd:�Z]ePd;�Z^ej2jj_e^d<�Z`d=�Zad>d?�Zbe*d@�ZcdA�ZddB�ZedC�ZfdD�Zge*dE�Zhe*dF�ZidG�ZjdH�ZkdI�ZldJ�ZmdK�ZndL�ZodM�ZpePdN�ZqdO�ZrdP�ZsePdQ�ZtePdR�ZudS�Zve*e*dT�ZwdU�ZxdV�ZydW�ZzeJePe*ePe*e'ej2j&j{dX��Z|eJePePe*e'ej2j&j{e*e*e*ePdY�	�Z}e*e*dZ�Z~ej2jj_e~d[�ZePe*e*d\�Z�e*e*ePd]�Z�eJe*e*d^��Z�d_�Z�ePePePe'e'e*ePePePePd`�
Z�daePePePdb�Z�e*e*dc�Z�dae*ePdd�Z�ePePePde�Z�df�Z�e*e*ej2j&j{dg�Z�e*e*ej2j&j{dh�Z�di�Z�e*e*ePdj�Z�dae*ePdk�Z�ePePdl�Z�ePe*e'ej2j&j{dm�Z�dn�Z�do�Z�dp�Z�dq�Z�dr�Z�ePds�Z�ePePdt�Z�du�Z�dv�Z�eJdw��Z�eJdx��Z�ej2jj_e�dy�Z�dzd{�Z�eJd|��Z�eJd}��Z�eJePd~��Z�eJd��Z�ej2jj_e�d��Z�e*e*d��Z�e*e*e*e*e*ePd��Z�eJePePePe'd�e*e*ePd���Z�eJd�ePePePePe'd�e*e*ePd��
�Z�ePePe'd�e*e*ePd��Z�ePePe'd�e*e*ePd��Z�ePePe'd�e*e*ePd��Z�ePePe'd�e*e*ePd��Z�ePePe'd�e*e*ePd��Z�d�ePePePePe'd�e*e*ePd��
Z�d�ePePePePe'd�e*e*ePd��
Z�d��Z�d��Z�ePePd�d��Z�ePd��Z�d��Z�ePd��Z�ePd��Z�d�d��Z�dad�ePe*d��Z�dS(�sV
Management of Docker Containers

.. versionadded:: 2015.8.0
.. versionchanged:: 2017.7.0
    This module has replaced the legacy docker execution module.

:depends: docker_ Python module

.. _`create_container()`: http://docker-py.readthedocs.io/en/stable/api.html#docker.api.container.ContainerApiMixin.create_container
.. _`create_host_config()`: http://docker-py.readthedocs.io/en/stable/api.html#docker.api.container.ContainerApiMixin.create_host_config
.. _`connect_container_to_network()`: http://docker-py.readthedocs.io/en/stable/api.html#docker.api.network.NetworkApiMixin.connect_container_to_network
.. _`create_network()`: http://docker-py.readthedocs.io/en/stable/api.html#docker.api.network.NetworkApiMixin.create_network
.. _`logs()`: http://docker-py.readthedocs.io/en/stable/api.html#docker.api.container.ContainerApiMixin.logs
.. _`IPAM pool`: http://docker-py.readthedocs.io/en/stable/api.html#docker.types.IPAMPool
.. _docker: https://pypi.python.org/pypi/docker
.. _docker-py: https://pypi.python.org/pypi/docker-py
.. _lxc-attach: https://linuxcontainers.org/lxc/manpages/man1/lxc-attach.1.html
.. _nsenter: http://man7.org/linux/man-pages/man1/nsenter.1.html
.. _docker-exec: http://docs.docker.com/reference/commandline/cli/#exec
.. _`docker-py Low-level API`: http://docker-py.readthedocs.io/en/stable/api.html
.. _timelib: https://pypi.python.org/pypi/timelib
.. _`trusted builds`: https://blog.docker.com/2013/11/introducing-trusted-builds/
.. _`Docker Engine API`: https://docs.docker.com/engine/api/v1.33/#operation/ContainerCreate

.. note::
    Older releases of the Python bindings for Docker were called docker-py_ in
    PyPI. All releases of docker_, and releases of docker-py_ >= 1.6.0 are
    supported. These python bindings can easily be installed using
    :py:func:`pip.install <salt.modules.pip.install>`:

    .. code-block:: bash

        salt myminion pip.install docker

    To upgrade from docker-py_ to docker_, you must first uninstall docker-py_,
    and then install docker_:

    .. code-block:: bash

        salt myminion pip.uninstall docker-py
        salt myminion pip.install docker

.. _docker-authentication:

Authentication
--------------

If you have previously performed a ``docker login`` from the minion, then the
credentials saved in ``~/.docker/config.json`` will be used for any actions
which require authentication. If not, then credentials can be configured in
Pillar data. The configuration schema is as follows:

.. code-block:: yaml

    docker-registries:
      <registry_url>:
        username: <username>
        password: <password>

For example:

.. code-block:: yaml

    docker-registries:
      hub:
        username: foo
        password: s3cr3t

.. note::
    As of the 2016.3.7, 2016.11.4, and 2017.7.0 releases of Salt, credentials
    for the Docker Hub can be configured simply by specifying ``hub`` in place
    of the registry URL. In earlier releases, it is necessary to specify the
    actual registry URL for the Docker Hub (i.e.
    ``https://index.docker.io/v1/``).

More than one registry can be configured. Salt will look for Docker credentials
in the ``docker-registries`` Pillar key, as well as any key ending in
``-docker-registries``. For example:

.. code-block:: yaml

    docker-registries:
      'https://mydomain.tld/registry:5000':
        username: foo
        password: s3cr3t

    foo-docker-registries:
      https://index.foo.io/v1/:
        username: foo
        password: s3cr3t

    bar-docker-registries:
      https://index.bar.io/v1/:
        username: foo
        password: s3cr3t

To login to the configured registries, use the :py:func:`docker.login
<salt.modules.dockermod.login>` function. This only needs to be done once for a
given registry, and it will store/update the credentials in
``~/.docker/config.json``.

.. note::
    For Salt releases before 2016.3.7 and 2016.11.4, :py:func:`docker.login
    <salt.modules.dockermod.login>` is not available. Instead, Salt will try to
    authenticate using each of your configured registries for each push/pull,
    behavior which is not correct and has been resolved in newer releases.


Configuration Options
---------------------

The following configuration options can be set to fine-tune how Salt uses
Docker:

- ``docker.url``: URL to the docker service (default: local socket).
- ``docker.version``: API version to use (should not need to be set manually in
  the vast majority of cases)
- ``docker.exec_driver``: Execution driver to use, one of ``nsenter``,
  ``lxc-attach``, or ``docker-exec``. See the :ref:`Executing Commands Within a
  Running Container <docker-execution-driver>` section for more details on how
  this config parameter is used.

These configuration options are retrieved using :py:mod:`config.get
<salt.modules.config.get>` (click the link for further information).

.. _docker-execution-driver:

Executing Commands Within a Running Container
---------------------------------------------

.. note::
    With the release of Docker 1.13.1, the Execution Driver has been removed.
    Starting in versions 2016.3.6, 2016.11.4, and 2017.7.0, Salt defaults to
    using ``docker exec`` to run commands in containers, however for older Salt
    releases it will be necessary to set the ``docker.exec_driver`` config
    option to either ``docker-exec`` or ``nsenter`` for Docker versions 1.13.1
    and newer.

Multiple methods exist for executing commands within Docker containers:

- lxc-attach_: Default for older versions of docker
- nsenter_: Enters container namespace to run command
- docker-exec_: Native support for executing commands in Docker containers
  (added in Docker 1.3)

Adding a configuration option (see :py:func:`config.get
<salt.modules.config.get>`) called ``docker.exec_driver`` will tell Salt which
execution driver to use:

.. code-block:: yaml

    docker.exec_driver: docker-exec

If this configuration option is not found, Salt will use the appropriate
interface (either nsenter_ or lxc-attach_) based on the ``Execution Driver``
value returned from ``docker info``. docker-exec_ will not be used by default,
as it is presently (as of version 1.6.2) only able to execute commands as the
effective user of the container. Thus, if a ``USER`` directive was used to run
as a non-privileged user, docker-exec_ would be unable to perform the action as
root. Salt can still use docker-exec_ as an execution driver, but must be
explicitly configured (as in the example above) to do so at this time.

If possible, try to manually specify the execution driver, as it will save Salt
a little work.

This execution module provides functions that shadow those from the :mod:`cmd
<salt.modules.cmdmod>` module. They are as follows:

- :py:func:`docker.retcode <salt.modules.dockermod.retcode>`
- :py:func:`docker.run <salt.modules.dockermod.run>`
- :py:func:`docker.run_all <salt.modules.dockermod.run_all>`
- :py:func:`docker.run_stderr <salt.modules.dockermod.run_stderr>`
- :py:func:`docker.run_stdout <salt.modules.dockermod.run_stdout>`
- :py:func:`docker.script <salt.modules.dockermod.script>`
- :py:func:`docker.script_retcode <salt.modules.dockermod.script_retcode>`


Detailed Function Documentation
-------------------------------
i(tabsolute_importsrestructuredtext enN(tCommandExecutionErrortSaltInvocationError(tsix(tmap(t	HighStatetnsentertimporttimport_tpstps_trmtrm_tsignaltsignal_tstarttstart_ttagttag_tapplytapply_ii	is([\d.]+)tdockertdockerngtmobyt	highstatetslscC@stry
t�}Wntk
r-tdfSX|dkrDtdfS|tkr�yt�jd�}Wntk
rd}nX|dks�|tkr�t	Stdj
djtt
t��djtt
|���fSntdj
djtt
t��djtt
|���fStdfS(s.
    Only load if docker libs are present
    s6Docker module found, but no version could be extractedtVersionInfos;Insufficient Docker version (required: {0}, installed: {1})t.s>Insufficient docker-py version (required: {0}, installed: {1})s7Could not import docker module, is docker-py installed?N(t
HAS_DOCKER_PYt_get_docker_py_versioninfot	ExceptiontFalsetNonet
MIN_DOCKER_PYtversiontgett
MIN_DOCKERt__virtualname__tformattjoinRtstr(tdocker_py_versioninfotdocker_versioninfo((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt__virtual__s.




tDockerJSONDecodercB@seZdd�ZRS(cC@sOg}xB|j�D]4}|s%qn|j|�\}}|j|�qW|S(N(t
splitlinest
raw_decodetappend(tselftst_wtobjstlinetobjt_((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytdecodeCsN(t__name__t
__module__R R7(((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR,BscC@s#ytjSWntk
rnXdS(s7
    Returns the version_info tuple from docker-py
    N(Rtversion_infotAttributeError(((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRMs
c
K@s�i}|tk	r||d<nxFdd fD]8\}}td|t�}|tk	r,|||<q,q,Wd|kr�dtjkr�tjjd�|d<nd|kr�d|d<ntdd	t�}|tk	r�td
dd|gd
t�}y�tjjj	|�}|dd}|dd}	d|	d|d<t
jjd|d|dfd|ddtdt
�|d<Wq�tk
r�}
tdj||
���q�Xnyt
j|�}Wn tk
r�t
j|�}nXtjdt|dd��|S(!Nttimeouttbase_urls
docker.urlR"sdocker.versions
config.gettDOCKER_HOSTtautosdocker.machinescmd.runsdocker-machinetinspecttpython_shelltHostOptionstAuthOptionstDrivert	IPAddressshttps://s:2376tclient_certtClientCertPatht
ClientKeyPathtca_certt
CaCertPathtassert_hostnametverifyttlssDocker machine {0} failed: {1}sdocker-py API version: %stapi_version(R=s
docker.url(sversionsdocker.version(tNOTSETt__salt__tostenvironR#RtsalttutilstjsontloadsRRMt	TLSConfigtTrueRRR&t	APIClientR;tClienttlogtdebugtgetattrR (R<tkwargst
client_kwargstkeytvaltparamtdocker_machinetdocker_machine_jsontdocker_machine_tlstdocker_machine_iptexctret((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_get_clientWsJ

	


cC@sL|jdi�jdt�r"dS|jdi�jdt�rDdSdSdS(s^
    Helper for deriving the current state of the container from the inspect
    results.
    tStatetPausedtpausedtRunningtrunningtstoppedN(R#R(tinspect_results((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt
_get_state�s
c@s"tj���fd��}|S(s^
    Decorator to run a function that requires the use of a docker.Client()
    instance.
    c@s�td|�}|jdt�}dtksBttdd�r[td||�td<nd}|tk	r�ttdd�r�tdj|kr�tdj}|td_n�||�}|dk	r�|td_n|S(s3
        Ensure that the client is present
        sargs.clean_kwargstclient_timeouts
docker.clientR<N(t	__utils__tpopROt__context__thasattrRiR R<(targsR^R<torig_timeoutRh(twrapped(s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytwrapper�s
(t	functoolstwraps(RyRz((Rys:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_docker_client�sc@s"tj���fd��}|S(s;
    Decorator to trigger a refresh of salt mine data.
    c@sI�|td|��}t�rEtdddtdtdt�n|S(s,
        refresh salt mine on exit.
        sargs.clean_kwargss	mine.sends	docker.pstverbosetallthost(Rst_check_update_mineRPRX(RwR^treturned(Ry(s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRz�s	#(R{R|(RyRz((Rys:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_refresh_mine_cache�s	cC@sDytd}Wn/tk
r?tdddt�}td<nX|S(Nsdocker.update_mines
config.gettdefault(RutKeyErrorRPRX(Rh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s

"cO@s�t|�}|dkrW||krWitd6i|d6|d6d6dj||�d6St||||�t�yt|�}Wntk
r�d}nXi||kd6i|d6|d6d6}|S(	s)
    Change the state of a container
    trestarttresulttoldtnewtstatesContainer '{0}' already {1}tcommentN(R�RR&t_client_wrappert_clear_contextRR (tnametactiontexpectedRwR^tpretpostRh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt
_change_state�s


cC@sdd}xWtt�D]I}y/|jd�rG||krGtj|�nWqtk
r[qXqWdS(	s9
    Clear the state/exists values stored in context
    s
docker.clientsdocker.exec_driversdocker._pull_statussdocker.docker_versionsdocker.docker_py_versionsdocker.N(s
docker.clientsdocker.exec_driversdocker._pull_statussdocker.docker_versionsdocker.docker_py_version(tlistRut
startswithRtR;(tkeep_contextR`((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s
cC@sRt|djtj|��dt�}y|j�dSWntk
rMdSXdS(s9
    Get the MD5 checksum of a file from a container
    s
md5sum {0}tignore_retcodeiN(t
run_stdoutR&tpipestquoteRXtsplitt
IndexErrorR (R�tpathtoutput((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_get_md5�s	
cC@s�d}|tkr�td|d�}|dk	r?|t|<|St�jdd�}|dkrm|t|<q�|jd�r�dt|<q�|jd�r�tr�dt|<q�|j�r�tr�tj	d	�dt|<q�t
d
j|���nt|S(s5
    Get the method to be used in shell commands
    sdocker.exec_drivers
config.gettExecutionDriversdocker-execslxc-s
lxc-attachsnative-Rs�ExecutionDriver from 'docker info' is blank, falling back to using 'nsenter'. To squelch this warning, set docker.exec_driver. See the Salt documentation for the docker module for more information.sWUnknown docker ExecutionDriver '{0}', or didn't find command to attach to the containerN(RuRPR tinfoR#R�tHAS_NSENTERtstripR[twarningtNotImplementedErrorR&(t
contextkeytfrom_configtdriver((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_get_exec_drivers*




cC@s�y`g|D]}||d^q
}|dk	r6|n|}g|D]}||krC|^qCSWn,ttfk
r�tdj|���nXdS(s�
    Returns a list of the top-level images (those which are not parents). If
    ``subset`` (an iterable) is passed, the top-level images in the subset will
    be returned, otherwise all top-level images will be returned.
    tParentIdsdInvalid image data passed to _get_top_level_images(). Please report this issue. Full image data: {0}N(R R�t	TypeErrorRR&(t	imagedatatsubsettxtparentstfilter_((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_get_top_level_images,s!'cC@s.gtdt�D]}|d ^qtd<dS(s�
    Populate __context__ with the current (pre-pull) image IDs (see the
    docstring for _pull_status for more information).
    Risdocker._pull_statusN(timagesRXRu(R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt
_prep_pull=scC@sXt|t�rNg}x<|D]+}|j|jdj|�dd��qWn|}|S(sx
    Remove container name from HostConfig:Links values to enable comparing
    container configurations correctly.
    s/{0}/t/i(t
isinstanceR�R/treplaceR&(tlinksR�Rhtl((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_scrub_linksEs
,cC@s&t|t�r"t|dd��S|S(NR`cS@s.|jd�|jdd�|jdd�fS(NtNametHarditSoft(R#(R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt<lambda>Ws(R�R�tsorted(t
ulimit_val((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_ulimit_sortTs	
cC@s�yjt|�}|dkr(dj|�S|d:}x4d
D],}|dkr[d	j||�S|d:}q9WWn"tk
r�tjd
|�dSXdS(s3
    Format bytes as human-readable file sizes
    is	{0} bytesg�@tKiBtMiBtGiBtTiBtPiBs{0:3.1f} {1}s#Unable to format file size for '%s'tunknownN(R�R�R�R�R�(tintR&RR[terror(tnumtunit((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt	_size_fmt]s



c	O@s�|jdt�}ttd|d�}|dksDt|d�r\tdj|���n|d
kr�ytdj�Wq�t	k
r�q�Xnd}y)t
jd|||�|||�}Wn�tj
jk
r}|rtd	j|jj|j���qU�nMtj
jk
r2}t|j���n#tk
rP}|j�}nX|Sd
j|�}|r�|dj|�7}nt|��dS(s>
    Common functionality for running low-level API calls
    tcatch_api_errorss
docker.clientt__call__sInvalid client action '{0}'tpushtpulltsFAttempting to run docker-py's "%s" function with args=%s and kwargs=%ssError {0}: {1}sUnable to perform {0}s: {0}N(spushspull(RtRXR]RuR RvRR&t
reload_configR;R[R\RterrorstAPIErrorRtresponsetstatus_codetexplanationtDockerExceptiont__str__R(	tattrRwR^R�tfuncterrRhRgtmsg((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�os<

cC@so|d}d|krB|jdg�j|j�j�d�nd|krk|j�j�d|d<ndS(sR
    Process a status update from a docker build, updating the data structure
    tstreams
Running intIntermediate_Containersi����sSuccessfully builttIdN(t
setdefaultR/trstripR�(tdatatitemR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt
_build_status�s
cC@su|d}yMd|krdStd�|D��rVdj||�|d<||d<nWnttfk
rpnXdS(sQ
    Process a status update from docker import, updating the data structure
    tstatussDownloading fromNcs@s|]}|tjkVqdS(N(tstringt	hexdigits(t.0R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pys	<genexpr>�ss{0}:{1}tImageR�(RR&R;R�(R�R�t	repo_nametrepo_tagR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_import_status�s
c@s��fd�}�fd�}dtkrDtjd�ttd<n|d}|dkrk||d�n�|dkr�||d�ns|jd	�r�|d
�d<nS|dkr�tdtk	r�|d}|tdkr�||�q�||�q�nd
S(sp
    Process a status update from a docker pull, updating the data structure.

    For containers created with older versions of Docker, there is no
    distinction in the status updates between layers that were already present
    (and thus not necessary to download), and those which were actually
    downloaded. Because of this, any function that needs to invoke this
    function needs to pre-fetch the image IDs by running _prep_pull() in any
    function that calls _pull_status(). It is important to grab this
    information before anything is pulled so we aren't looking at the state of
    the images post-pull.

    We can't rely on the way that __context__ is utilized by the images()
    function, because by design we clear the relevant context variables once
    we've made changes to allow the next call to images() to pick up any
    changes that were made.
    c@s>�jdi�jdg�}||kr:|j|�ndS(s&
        Layer already exists
        tLayerstAlready_PulledN(R�R/(tid_talready_pulled(R�(s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_already_exists�sc@s>�jdi�jdg�}||kr:|j|�ndS(s$
        Pulled a new layer
        R�tPulledN(R�R/(R�tpulled(R�(s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt
_new_layer�ssdocker._pull_statuss�_pull_status context variable was not populated, information on downloaded layers may be inaccurate. Please report this to the SaltStack development team, and if possible include the image (and tag) that was being pulled.R�sAlready existstids
Pull completesStatus: itStatussDownload completeN(RuR[R�ROR�(R�R�R�R�R�R�((R�s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_pull_status�s&		



cC@s�|dj�}d|kr�d|ks4d|krf|jdi�jdg�}|j|d�q�d|ks~|dkr�|jdi�jd	g�}|j|d�q�nd
S(sQ
    Process a status update from a docker push, updating the data structure
    R�R�salready pushedsalready existsR�tAlready_Pushedssuccessfully pushedtpushedtPushedN(tlowerR�R/(R�R�R�talready_pushedR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_push_status�scC@s�|d}d|krxy)dj|dd|ddf�}Wq�tk
rtdj|dd|dd�}q�Xn|dd}|j|�dS(s;
    Process an API error, updating the data structure
    terrorDetailtcodes: tmessages{0}: {1}N(R'R�R&R/(R�R�R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt
_error_detail	s

cC@stdd|�S(s{
    .. versionadded:: 2016.3.6,2016.11.4,2017.7.0
    .. versionchanged:: 2017.7.0
        Replaced the container config args with the ones from the API's
        ``create_container`` function.
    .. versionchanged:: 2018.3.0
        Added ability to limit the input to specific client functions

    Many functions in Salt have been written to support the full list of
    arguments for a given function in the `docker-py Low-level API`_. However,
    depending on the version of docker-py installed on the minion, the
    available arguments may differ. This function will get the arguments for
    various functions in the installed version of docker-py, to be used as a
    reference.

    limit
        An optional list of categories for which to limit the return. This is
        useful if only a specific set of arguments is desired, and also keeps
        other function's argspecs from needlessly being examined.

    **AVAILABLE LIMITS**

    - ``create_container`` - arguments accepted by `create_container()`_ (used
      by :py:func:`docker.create <salt.modules.dockermod.create>`)
    - ``host_config`` - arguments accepted by `create_host_config()`_ (used to
      build the host config for :py:func:`docker.create
      <salt.modules.dockermod.create>`)
    - ``connect_container_to_network`` - arguments used by
      `connect_container_to_network()`_ to construct an endpoint config when
      connecting to a network (used by
      :py:func:`docker.connect_container_to_network
      <salt.modules.dockermod.connect_container_to_network>`)
    - ``create_network`` - arguments accepted by `create_network()`_ (used by
      :py:func:`docker.create_network <salt.modules.dockermod.create_network>`)
    - ``ipam_config`` - arguments used to create an `IPAM pool`_ (used by
      :py:func:`docker.create_network <salt.modules.dockermod.create_network>`
      in the process of constructing an IPAM config dictionary)

    CLI Example:

    .. code-block:: bash

        salt myminion docker.get_client_args
        salt myminion docker.get_client_args logs
        salt myminion docker.get_client_args create_container,connect_container_to_network
    sdocker.get_client_argstlimit(Rs(R((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytget_client_argss/c
K@s�|jdi�}|jdd�|krFi||d|d6}ni}tdtjjjjd|d|d|td|��}|r�t|�|d	<n|dkryt
d
dg�}Wqtk
r}tj
d|j�d
t�tdj|���qXni}i}i}	x�t|�D]}}
|
|dkrZ|j|
�||
<q+n|
|d
kr+|
dkr�|j|j|
��q+|j|
�|	|
<q+q+q+Wtd|�|	d<|	dj|�|	|fS(sl
    Take input kwargs and return a kwargs dict to pass to docker-py's
    create_container() function.
    tnetworkstnetwork_modeR�sdocker.translate_inputtskip_translatetignore_collisionstvalidate_ip_addrssargs.clean_kwargstnetworking_configtcreate_containerthost_configs.docker.create: Error getting client args: '%s'texc_infosFailed to get client args: {0}tcreate_host_configN(RtR#RsRSRTRt	translatet	containert_create_networking_configR RRR[R�R�RXR&R�tupdateR�(RRRtclient_argsR^RRgtfull_host_configthost_kwargst
create_kwargstarg((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_get_create_kwargsQsF
	
c
C@s�td|pg�}t|�}t|�}i}x�dD]�}x�||D]�}||krdqLn|||}||j|�}	|d
ks�|dks�|	dkr�t|�t|	�kri|d6|	d6|j|i�|<qqL|dkrMt|�d}
t|	�d}|
|kri|
d6|d6|j|i�|<qqL|d	kr�tt||��}tt|	|��}	n|d
kr�t	|�}t	|	�}	n|dkr�t|�}t|	�}	n||	krLi|d6|	d6|j|i�|<qLqLWx�||D]�}||ks||j|i�krFqn||j|�}|||}	|dks�|dks�|	dkr�t|�t|	�kr�i|d6|	d6|j|i�|<q�q|dkr/t|�d}
t|	�d}|
|kr�i|
d6|d6|j|i�|<q�q|d	krhtt||��}tt|	|��}	n|d
kr�t	|�}t	|	�}	n|dkr�t|�}t|	�}	n||	kri|d6|	d6|j|i�|<qqWq;W|S(s
    .. versionadded:: 2017.7.0
    .. versionchanged:: 2018.3.0
        Renamed from ``docker.compare_container`` to
        ``docker.compare_containers`` (old function name remains as an alias)

    Compare two containers' Config and and HostConfig and return any
    differences between the two.

    first
        Name or ID of first container

    second
        Name or ID of second container

    ignore
        A comma-separated list (or Python list) of keys to ignore when
        comparing. This is useful when comparing two otherwise identical
        containers which have different hostnames.


    CLI Examples:

    .. code-block:: bash

        salt myminion docker.compare_containers foo bar
        salt myminion docker.compare_containers foo bar ignore=Hostname
    sargs.split_inputtConfigt
HostConfigtOomKillDisableR�R�R�R�tLinkstUlimitstEnv(RR(RN(R(
Rstinspect_containerR#R tboolR�t
inspect_imageR�R�R�(tfirsttsecondtignoretresult1tresult2Rht	conf_dictR�tval1tval2timage1timage2((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytcompare_containers�sl
$**+$$**/tcompare_containerc	@s�d�}td�t|t�s.t|�n|}t|t�sOt|�n|}||��||��t|�}t|�}t��}|j��x�|D]�}yt|�jdi�}	Wn)t	k
r�}
t
jd||
�q�q�X|dkr%|�kr%|d|	kr%�|=n|dkr�|�kr�|d|	kr��|=q�q�Wi}���fd�}x��fd��D�D]�}x��jd	g�D]�}
�|j|
�}|
d
kr�|||d|�n|r�|
dkr5y|j|d
d�Wnt
tfk
r%q5X|s5q�q5ni|d6dd6|j|i�|
<q�q�Wq�Wx~�D]v}|�krPxa�jd	g�D]�}
�|j|
�}|
d
kr�|||d|�q�q�|r�|
dkr"y|j|d
d�Wnt
tfk
rq"X|s"q�q"nidd6|d6|j|i�|
<q�q�Wqkx��jd	g�D]z}
�||
}�||
}x6||fD](}y|j�Wq�tk
r�q�Xq�W|
dkrQy|j|d
d�Wntt
fk
r�nX|sd}ny|j|d
d�Wntt
fk
r>nX|s|d}q|n+|
d
kr||||d|d|�qcnt|�t|�ko�tknr�qcqc||krci|d6|d6|j|i�|
<qcqcWqkW|S(s�
    .. versionadded:: 2018.3.0

    Returns the differences between two containers' networks. When a network is
    only present one of the two containers, that network's diff will simply be
    represented with ``True`` for the side of the diff in which the network is
    present) and ``False`` for the side of the diff in which the network is
    absent.

    This function works by comparing the contents of both containers'
    ``Networks`` keys (under ``NetworkSettings``) in the return data from
    :py:func:`docker.inspect_container
    <salt.modules.dockermod.inspect_container>`. Because each network contains
    some items that either A) only set at runtime, B) naturally varying from
    container to container, or both, by default the following keys in each
    network are examined:

    - **Aliases**
    - **Links**
    - **IPAMConfig**

    The exception to this is if ``IPAMConfig`` is unset (i.e. null) in one
    container but not the other. This happens when no static IP configuration
    is set, and automatic IP configuration is in effect. So, in order to report
    on changes between automatic IP configuration in one container and static
    IP configuration in another container (as we need to do for the
    :py:func:`docker_container.running <salt.states.docker_container.running>`
    state), automatic IP configuration will also be checked in these cases.

    This function uses the :conf_minion:`docker.compare_container_networks`
    minion config option to determine which keys to examine. This provides
    flexibility in the event that features added in a future Docker release
    necessitate changes to how Salt compares networks. In these cases, rather
    than waiting for a new Salt release one can just set
    :conf_minion:`docker.compare_container_networks`.

    .. note::
        The checks for automatic IP configuration described above only apply if
        ``IPAMConfig`` is among the keys set for static IP checks in
        :conf_minion:`docker.compare_container_networks`.

    first
        Name or ID of first container (old)

    second
        Name or ID of second container (new)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.compare_container_networks foo bar
    cS@s|jdi�jdi�S(NtNetworkSettingstNetworks(R#(R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt	_get_nets"ss!docker.compare_container_networkst
Containerss'Failed to inspect Docker network %s: %sRnR�c@s�d|k}|rt}nt|d�}|o6|}d|k}|rTt}nt|d�}|oo|}�jdg�}	|rm|s�|rmxN|	D]F}
��j|
�}|r�i|d6dd6�j�i�|
<q�q�W|ridd6|dd6�j�i�d<nt��fd�|	D��s�idd6|rMdndd6�j�i�d<q�n:|rV|s|rVxN|	D]F}
��j|
�}|r�idd6|d6�j�i�|
<q�q�Wt��fd	�|	D��s"i|r�dndd6dd6�j�i�d<n|r�i|dd6dd6�j�i�d<q�nQ|jd�}|jd�}
||
kr�i|d6|
d6�j�i�d<ndS(
NR�R�t	automatict
IPAMConfigc3@s'|]}|�j�i�kVqdS(N(R#(R�R�(tnet_nameRh(s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pys	<genexpr>jststatics
not connectedtIPConfigurationc3@s'|]}|�j�i�kVqdS(N(R#(R�R�(R3Rh(s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pys	<genexpr>vs(RRR#R R�tany(RhR3R^t
nets1_missingtnets1_statictnets1_autoipt
nets2_missingtnets2_statictnets2_autoiptautoip_keyst
autoip_keyt
autoip_valtold_valtnew_val(tcompare_keystnets1tnets2(R3Rhs:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_check_ipconfigNsT		
((,
(+c3@s!|]}|�kr|VqdS(N((R�R�(RD(s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pys	<genexpr>�sR4R2R�tAliasesRtHostnameR�N(t__opts__R�tdictRR�tsetRtinspect_networkR#RR[R�tremovet
ValueErrorR;R R�tsortRR(R!R"R/R$R%tstate1tstate2tall_netsR3tconnected_containersRgRhRER`RaR@RAR�((RBRCRDs:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytcompare_container_networks�s�7	




;	/
	.
	(,sName,Id,Created,Containersc	@s�td�pg��t|t�s1t|�n|}t|t�sRt|�n|}i}x�|D]�}|�kr}qen
�j|�||}|j|�}t|�t|�ko�tknr�qeqe|dkr�x1|D]�}	||	}
|j|	�}t|
�t|�ko&tknr1q�q�|	dkr�d�}t|dd|�}
t|jdg�d|�}|
|kr�i|
d6|d6|j	di�d<q�q�|
|kr�i|
d6|d6|j	di�|	<q�q�Wqe||krei|d6|d6||<qeqeWx��fd�|D�D]t}|j|�}||}t|�t|�kontknryq,q,||kr,i|d6|d6||<q,q,W|S(	s�
    .. versionadded:: 2018.3.0

    Compare two networks and return any differences between the two

    first
        Name or ID of first container

    second
        Name or ID of second container

    ignore : Name,Id,Created,Containers
        A comma-separated list (or Python list) of keys to ignore when
        comparing.


    CLI Example:

    .. code-block:: bash

        salt myminion docker.compare_network foo bar
    sargs.split_inputtIPAMRcS@s(ttj|��ttj|��fS(N(R�Rtiterkeyst
itervalues(R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�sR`R�R�c3@s!|]}|�kr|VqdS(N((R�R�(R#(s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pys	<genexpr>s(
RsR�RIRKR/R#RRR�R�(R!R"R#tnet1tnet2RhR�R'R(tsubkeytsubval1tsubval2tkvsorttconfig1tconfig2((R#s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytcompare_networks�sL!!


(

(	'+
(cC@s�t|�jdi�}i}xwtj|�D]f\}}y|jd�}Wn0ttfk
rtjd|||�q.q.X||d<|||<q.W|s�t	|�S|S(s`
    .. versionadded:: 2018.3.0

    Return a list of running containers attached to the specified network

    name
        Network name

    verbose : False
        If ``True``, return extended info about each container (IP
        configuration, etc.)

    CLI Example:

    .. code-block:: bash

        salt myminion docker.connected net_name
    R0R�s�'Name' key not present in container definition for container ID '%s' within inspect results for Docker network '%s'. Full container definition: %sR�(
RKR#Rt	iteritemsRtR�R;R[R�R�(R�R~t
containersRhtcidtcinfo((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt	connected!s


c
G@s�tjdi�}idd6}|jdg�}t|t�sV|jd�i}nx�tjt�D]q\}}yQ|jd�r�y|j	|�Wq�t
k
r�|jdj|��q�XnWqftk
r�qfXqfW|s�t
|�}n|jdi�}xq|D]i}||kr7|jd	j|��q	ny ||d
}||d}	WnRt
k
r�|jdj|��q	tk
r�}
|jd
j|
|��q	Xddd|d|	g}|j�dkr�|j|�ntjd||�td|dtdd�}|ddk||<||s	|drQ|j|d�qr|drr|j|d�qrq	q	W|r�d|d<n|S(s�
    .. versionadded:: 2016.3.7,2016.11.4,2017.7.0

    Performs a ``docker login`` to authenticate to one or more configured
    repositories. See the documentation at the top of this page to configure
    authentication credentials.

    Multiple registry URLs (matching those configured in Pillar) can be passed,
    and Salt will attempt to login to *just* those registries. If no registry
    URLs are provided, Salt will attempt to login to *all* configured
    registries.

    **RETURN DATA**

    A dictionary containing the following keys:

    - ``Results`` - A dictionary mapping registry URLs to the authentication
      result. ``True`` means a successful login, ``False`` means a failed
      login.
    - ``Errors`` - A list of errors encountered during the course of this
      function.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.login
        salt myminion docker.login hub
        salt myminion docker.login hub https://mydomain.tld/registry/
    sdocker-registriesitretcodetErrorss5'docker-registries' Pillar value must be a dictionarys-docker-registriess''{0}' Pillar value must be a dictionarytResultss!No match found for registry '{0}'tusernametpasswords(Invalid configuration for registry '{0}'sMissing {0} for registry '{1}'Rtlogins-us-pthubs8Attempting to login to docker registry '%s' as user '%s'scmd.run_allRAtoutput_logleveltquiettstderrtstdouti(t
__pillar__R#R�R�RIR/RR`tendswithRR�R&R;R�R�R�R[R\RPR(
t
registriest
registry_authRhR�R`R�tresultstregistryRhRiRgtcmdt	login_cmd((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRjMsh"

	




	



cC@s�t|�d}g}xjtjtdtdt��D]J}|dd|kr5|jg|dD]}|jd�^q`�q5q5Wi|d6gtjtdt��D]&\}}|d	|kr�|d
 ^q�d6S(s�
    Returns the containers and images, if any, which depend on the given image

    name
        Name or ID of image


    **RETURN DATA**

    A dictionary containing the following keys:

    - ``Containers`` - A list of containers which depend on the specified image
    - ``Images`` - A list of IDs of images which depend on the specified image


    CLI Example:

    .. code-block:: bash

        salt myminion docker.depends myimage
        salt myminion docker.depends 0123456789ab
    R�RR~tInfoR�tNamesR�R0R�itImages(	R RRVR
RXtextendtlstripR`R�(R�timage_idtcontainer_dependsRR�ty((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytdepends�s%.%cC@s�td|�}idd6dd6dd6}i}xA|D]9}|j|dd	�}|j|g�j|d
�q7Wd	|kr�tjd|�n|S(s�
    Get information on changes made to container's filesystem since it was
    created. Equivalent to running the ``docker diff`` Docker CLI command.

    name
        Container name or ID


    **RETURN DATA**

    A dictionary containing any of the following keys:

    - ``Added`` - A list of paths that were added.
    - ``Changed`` - A list of paths that were changed.
    - ``Deleted`` - A list of paths that were deleted.

    These keys will only be present if there were changes, so if the container
    has no differences the return dict will be empty.


    CLI Example:

    .. code-block:: bash

        salt myminion docker.diff mycontainer
    tdifftChangeditAddeditDeleteditKindtUnknowntPaths�Unknown changes detected in docker.diff of container %s. This is probably due to a change in the Docker API. Please report this to the SaltStack developers(R�R#R�R/R[R�(R�tchangestkind_mapRhtchangeR`((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s
!
cC@srdj|�}|tkr#t|Sytd|dt�}Wn!tjjk
r_tt|<nXtt|<t|S(s

    Check if a given container exists

    name
        Container name or ID


    **RETURN DATA**

    A boolean (``True`` if the container exists, otherwise ``False``)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.exists mycontainer
    sdocker.exists.{0}RR�(R&RuR�RRR�R�RX(R�R�tc_info((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytexistss

c
C@sptd|�}idd6dd6}tjd�}g}xt|�D]�}i}xitj|�D]X\}}	|j||�}
|
dkr�|	s�d}	q�|jd|	�}	n|	||
<qaWd|kr�tj	d	tj
|d��|d
<nx:d
D]2}||kr�t||�|dj|�<q�q�W|j
tj|��qEW|rlg|D]}|jd�^qSS|S(sF
    Return the history for an image. Equivalent to running the ``docker
    history`` Docker CLI command.

    name
        Container name or ID

    quiet : False
        If ``True``, the return data will simply be a list of the commands run
        to build the container.

        .. code-block:: bash

            $ salt myminion docker.history nginx:latest quiet=True
            myminion:
                - FROM scratch
                - ADD file:ef063ed0ae9579362871b9f23d2bc0781ef7cd4de6ac822052cf6c9c5a12b1e2 in /
                - CMD [/bin/bash]
                - MAINTAINER NGINX Docker Maintainers "docker-maint@nginx.com"
                - apt-key adv --keyserver pgp.mit.edu --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
                - echo "deb http://nginx.org/packages/mainline/debian/ wheezy nginx" >> /etc/apt/sources.list
                - ENV NGINX_VERSION=1.7.10-1~wheezy
                - apt-get update &&     apt-get install -y ca-certificates nginx=${NGINX_VERSION} &&     rm -rf /var/lib/apt/lists/*
                - ln -sf /dev/stdout /var/log/nginx/access.log
                - ln -sf /dev/stderr /var/log/nginx/error.log
                - VOLUME [/var/cache/nginx]
                - EXPOSE map[80/tcp:{} 443/tcp:{}]
                - CMD [nginx -g daemon off;]
                        https://github.com/saltstack/salt/pull/22421


    **RETURN DATA**

    If ``quiet=False``, the return value will be a list of dictionaries
    containing information about each step taken to build the image. The keys
    in each step include the following:

    - ``Command`` - The command executed in this build step
    - ``Id`` - Layer ID
    - ``Size`` - Cumulative image size, in bytes
    - ``Size_Human`` - Cumulative image size, in human-readable units
    - ``Tags`` - Tag(s) assigned to this layer
    - ``Time_Created_Epoch`` - Time this build step was completed (Epoch
      time)
    - ``Time_Created_Local`` - Time this build step was completed (Minion's
      local timezone)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.exists mycontainer
    thistorytCommandt	CreatedBytTime_Created_EpochtCreateds^/bin/sh -c (?:#\(nop\) )?sFROM scratchR�s%Y-%m-%d %H:%M:%S %ZtTime_Created_LocaltSizes	{0}_Human(R�(R�tretcompiletreversedRR`R#tsubttimetstrftimet	localtimeR�R&R/tcopytdeepcopy(
R�RmR�tkey_maptcommand_prefixRhR�tstepR`Ratstep_keyRbR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�#s47
	
$ c
K@s"dtkr�tdd|jdt��}idd6}xR|D]G}|jdd�}|dkrhq>nx�|D]{}|ddgdfkr�d	nd
}tjdi�}|j|i�}|j||�}	|||j|i�|	<qoWd|j|i�kr4tjdtj	||d��||d<nxNdD]F}
|
|j|i�kr;t
|||
�||dj|
�<q;q;Wq>Wntjdi�}tj
|jd
i��}|jdt�r�|jtj
|jd	i���n|rx%|D]}t|�||d<q�Wn|S(st
    Returns information about the Docker images on the Minion. Equivalent to
    running the ``docker images`` Docker CLI command.

    all : False
        If ``True``, untagged images will also be returned

    verbose : False
        If ``True``, a ``docker inspect`` will be run on each image returned.


    **RETURN DATA**

    A dictionary with each key being an image ID, and each value some general
    info about that image (time created, size, tags associated with the image,
    etc.)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.images
        salt myminion docker.images all=True
    s
docker.imagesR�RR�R�R�tRepoTagss
<none>:<none>tuntaggedttaggeds%Y-%m-%d %H:%M:%S %ZR�R�tVirtualSizes	{0}_HumanRxN(sSizeR�(RuR�R#RRtR R�R�R�R�R�R&R�R�RR (
R~R^R�R�timgtimg_idR�t	img_statetbuckettimg_keyRbtcontext_dataRh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�|s@


%
3%
cC@s
td�S(s�
    Returns a dictionary of system-wide information. Equivalent to running
    the ``docker info`` Docker CLI command.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.info
    R�(R�(((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��scC@syt|�SWn(tk
r8}d|jkr9�q9nXyt|�SWn+tk
rt}|jjd�su�qunXyt|�SWn+tk
r�}|jjd�s��q�nXyt|�SWn+tk
r�}|jjd�s��q�nXtdj|���dS(s�
    .. versionchanged:: 2017.7.0
        Volumes and networks are now checked, in addition to containers and
        images.

    This is a generic container/image/volume/network inspecton function. It
    will run the following functions in order:

    - :py:func:`docker.inspect_container
      <salt.modules.dockermod.inspect_container>`
    - :py:func:`docker.inspect_image <salt.modules.dockermod.inspect_image>`
    - :py:func:`docker.inspect_volume <salt.modules.dockermod.inspect_volume>`
    - :py:func:`docker.inspect_network <salt.modules.dockermod.inspect_network>`

    The first of these to find a match will be returned.

    name
        Container/image/volume/network name or ID


    **RETURN DATA**

    A dictionary of container/image/volume/network information


    CLI Example:

    .. code-block:: bash

        salt myminion docker.inspect mycontainer
        salt myminion docker.inspect busybox
    sdoes not exists	Error 404s6Error 404: No such image/container/volume/network: {0}N(RRtstrerrorR R�tinspect_volumeRKR&(R�Rg((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR@�s,!



cC@s
td|�S(s�
    Retrieves container information. Equivalent to running the ``docker
    inspect`` Docker CLI command, but will only look for container information.

    name
        Container name or ID


    **RETURN DATA**

    A dictionary of container information


    CLI Example:

    .. code-block:: bash

        salt myminion docker.inspect_container mycontainer
        salt myminion docker.inspect_container 0123456789ab
    R(R�(R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR
scC@sPtd|�}x:dD]2}||krt||�|dj|�<qqW|S(s�
    Retrieves image information. Equivalent to running the ``docker inspect``
    Docker CLI command, but will only look for image information.

    .. note::
        To inspect an image, it must have been pulled from a registry or built
        locally. Images on a Docker registry which have not been pulled cannot
        be inspected.

    name
        Image name or ID


    **RETURN DATA**

    A dictionary of image information


    CLI Examples:

    .. code-block:: bash

        salt myminion docker.inspect_image busybox
        salt myminion docker.inspect_image centos:6
        salt myminion docker.inspect_image 0123456789ab
    R R�R�s	{0}_Human(sSizesVirtualSize(R�R�R&(R�RhRb((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR "s

$cK@s�t�}x�tjtd|jdt���D]a}|jd�}|sOq.nx=g|p^gD]}|jd�^q_D]}|j|�qxWq.Wt|�S(s�
    Returns a list of containers by name. This is different from
    :py:func:`docker.ps <salt.modules.dockermod.ps_>` in that
    :py:func:`docker.ps <salt.modules.dockermod.ps_>` returns its results
    organized by container ID.

    all : False
        If ``True``, stopped containers will be included in return data

    CLI Example:

    .. code-block:: bash

        salt myminion docker.inspect_image <image>
    RRyR�(	RJRRVR
R#RR|taddR�(R^RhR�tnamesR�tc_name((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytlist_containersDs	+/cC@s\t�}xFtjt��D]2}|jd�s7qn|jt|d��qWt|�S(s}
    Returns a list of tagged images

    CLI Example:

    .. code-block:: bash

        salt myminion docker.list_tags
    R�(RJRRVR�R#RR�(RhR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt	list_tags^s
	cC@sSyt|�}|dSWn4tk
r+n$tk
rNtjd||�nXtS(s�
    .. versionadded:: 2018.3.0

    Given an image name (or partial image ID), return the full image ID. If no
    match is found among the locally-pulled images, then ``False`` will be
    returned.

    CLI Examples:

    .. code-block:: bash

        salt myminion docker.resolve_image_id foo
        salt myminion docker.resolve_image_id foo:bar
        salt myminion docker.resolve_image_id 36540f359ca3
    R�sFInspecting docker image '%s' returned an unexpected data structure: %s(R RR�R[R�R(R�tinspect_result((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytresolve_image_idps

cK@s�td|�}|jdt�}|r9td|�n|dk	rYtddd�ny5t|�}|d}|r�|r�|Sn|dSWnEtk
r�tStk
r�tjd	||�nt	k
r�nX|r�|d
gS|d
S(s�
    .. versionadded:: 2017.7.2
    .. versionchanged:: 2018.3.0
        Instead of matching against pulled tags using
        :py:func:`docker.list_tags <salt.modules.dockermod.list_tags>`, this
        function now simply inspects the passed image name using
        :py:func:`docker.inspect_image <salt.modules.dockermod.inspect_image>`
        and returns the first matching tag. If no matching tags are found, it
        is assumed that the passed image is an untagged image ID, and the full
        ID is returned.

    Inspects the specified image name and returns the first matching tag in the
    inspect results. If the specified image is not pulled locally, this
    function will return ``False``.

    name
        Image name to resolve. If the image is found but there are no tags,
        this means that the image name passed was an untagged image. In this
        case the image ID will be returned.

    all : False
        If ``True``, a list of all matching tags will be returned. If the image
        is found but there are no tags, then a list will still be returned, but
        it will simply contain the image ID.

        .. versionadded:: 2018.3.0

    tags
        .. deprecated:: 2018.3.0
            Ignored if passed, will be removed in the Neon release.

    CLI Examples:

    .. code-block:: bash

        salt myminion docker.resolve_tag busybox
        salt myminion docker.resolve_tag centos:7 all=True
        salt myminion docker.resolve_tag c9f378ac27d9
    sargs.clean_kwargsRsargs.invalid_kwargssversions.warn_untiltNeonswThe 'tags' argument to docker.resolve_tag is deprecated. It no longer is used, and will be removed in the Neon release.R�isFInspecting docker image '%s' returned an unexpected data structure: %sR�N(
RsRtRR R RR�R[R�R�(R�ttagsR^tall_R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytresolve_tag�s0(





cK@s�td|�}d|kr+td��nyt|d�|d<Wnxtk
rVnhttfk
r�tr�ytj|d�|d<Wq�t	k
r�}t
jd|d|�q�Xq�nXtj
jjtd||��S(s
    .. versionchanged:: 2018.3.0
        Support for all of docker-py's `logs()`_ function's arguments, with the
        exception of ``stream``.

    Returns the logs for the container. An interface to docker-py's `logs()`_
    function.

    name
        Container name or ID

    stdout : True
        Return stdout lines

    stderr : True
        Return stdout lines

    timestamps : False
        Show timestamps

    tail : all
        Output specified number of lines at the end of logs. Either an integer
        number of lines or the string ``all``.

    since
        Show logs since the specified time, passed as a UNIX epoch timestamp.
        Optionally, if timelib_ is installed on the minion the timestamp can be
        passed as a string which will be resolved to a date using
        ``timelib.strtodatetime()``.

    follow : False
        If ``True``, this function will block until the container exits and
        return the logs when it does. The default behavior is to return what is
        in the log at the time this function is executed.

        .. note:
            Since it blocks, this option should be used with caution.


    CLI Examples:

    .. code-block:: bash

        # All logs
        salt myminion docker.logs mycontainer
        # Last 100 lines of log
        salt myminion docker.logs mycontainer tail=100
        # Just stderr
        salt myminion docker.logs mycontainer stdout=False
        # Logs since a specific UNIX timestamp
        salt myminion docker.logs mycontainer since=1511688459
        # Flexible format for "since" argument (requires timelib)
        salt myminion docker.logs mycontainer since='1 hour ago'
        salt myminion docker.logs mycontainer since='1 week ago'
        salt myminion docker.logs mycontainer since='1 fortnight ago'
    sargs.clean_kwargsR�s&The 'stream' argument is not supportedtsinces3docker.logs: Failed to parse '%s' using timelib: %stlogs(RsRR�R�RMR�tHAS_TIMELIBttimelibt
strtodatetimeRR[R�RSRTtstringutilst
to_unicodeR�(R�R^Rg((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s"9
cC@st|�ddS(s�
    Returns the PID of a container

    name
        Container name or ID

    CLI Example:

    .. code-block:: bash

        salt myminion docker.pid mycontainer
        salt myminion docker.pid 0123456789ab
    RjtPid(R(R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytpid.sc@s�ttjd|��}|r9tjtdt�|�n|g}|dkrWd}n�t|t	j
�r{dj|�}n�dj|�}y^|jd�\}}}|j
�}|j�s�|d
kr�t|��n|d|}Wntk
rt|��nXi}	x^|D]V}
t|
�jd	i�jd
i��t�fd�tj�|�D��|	|
<qW|s�|	j|i�S|	S(sR
    Returns port mapping information for a given container. Equivalent to
    running the ``docker port`` Docker CLI command.

    name
        Container name or ID

        .. versionchanged:: 2019.2.0
            This value can now be a pattern expression (using the
            pattern-matching characters defined in fnmatch_). If a pattern
            expression is used, this function will return a dictionary mapping
            container names which match the pattern to the mappings for those
            containers. When no pattern expression is used, a dictionary of the
            mappings for the specified container name will be returned.

        .. _fnmatch: https://docs.python.org/2/library/fnmatch.html

    private_port : None
        If specified, get information for that specific port. Can be specified
        either as a port number (i.e. ``5000``), or as a port number plus the
        protocol (i.e. ``5000/udp``).

        If this argument is omitted, all port mappings will be returned.


    **RETURN DATA**

    A dictionary of port mappings, with the keys being the port and the values
    being the mapping(s) for that port.


    CLI Examples:

    .. code-block:: bash

        salt myminion docker.port mycontainer
        salt myminion docker.port mycontainer 5000
        salt myminion docker.port mycontainer 5000/udp
    s[*?\[]Rt*s{0}/*siInvalid private_port '{0}'. Must either be a port number, or be in port/protocol notation (e.g. 5000/tcp)R�ttcptudpR-tPortsc3@s|]}|�|fVqdS(N((R�R�(tmappings(s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pys	<genexpr>�sN(R�R�(RR�tsearchtfnmatchtfilterR�RXR R�Rt
integer_typesR&t	partitionR�tisdigitRR;RR#RI(R�tprivate_porttpattern_usedR�tpatternR�tport_numR6tprotocolRhR�((R�s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytport?s0(!			

!cK@s�tddtd|�}idd6}i}x�|D]�}|jdd�}|dkr\q2nxy|D]q}|jdd�j�jd	�r�d
nd}|j|i�}	|j||�}
|||	j|i�|
<qcWd|	j|i�kr2tj	dtj
|	|d��|	|d
<q2q2Wtj|jd
i��}|jdt
�rt|jtj|jdi���n|jdt
�r�x%|D]}t|�||d<q�Wn|jdt
�r�|jdi�jdi�jtd��n|S(s6
    Returns information about the Docker containers on the Minion. Equivalent
    to running the ``docker ps`` Docker CLI command.

    all : False
        If ``True``, stopped containers will also be returned

    host: False
        If ``True``, local host's network topology will be included

    verbose : False
        If ``True``, a ``docker inspect`` will be run on each container
        returned.

    filters: None
        A dictionary of filters to be processed on the container list.
        Available filters:

          - exited (int): Only containers with specified exit code
          - status (str): One of restarting, running, paused, exited
          - label (str): format either "key" or "key=value"

    **RETURN DATA**

    A dictionary with each key being an container ID, and each value some
    general info about that container (time created, name, command, etc.)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.ps
        salt myminion docker.ps all=True
        salt myminion docker.ps filters="{'label': 'role=web'}"
    RaRtfiltersR�R�R�R�R�sup RnRos%Y-%m-%d %H:%M:%S %ZR�R~RxR�t
interfacessnetwork.interfacesN(R�RXRtR R#R�R�R�R�R�R�R�R�RRRRP(R�R^R�R�R�Rtc_idR�tc_stateR�tc_keyRh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR
�s:%


')%
cC@sAdj|�}|tkr#t|Stt|��t|<t|S(s9
    Returns the state of the container

    name
        Container name or ID


    **RETURN DATA**

    A string representing the current state of the container (either
    ``running``, ``paused``, or ``stopped``)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.state mycontainer
    sdocker.state.{0}(R&RuRqR(R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s
c
C@s[td|�}|s-tdj|���nidd6dd6dd6d	d
6}g}|rk|jd�n|r�|jd�ni}xl|D]d}|jdd�}|dk	r�x=|D]2}	|j|	|	�}
||	|j|i�|
<q�Wq�q�W|s|Si}xNtj	|�D]=\}	}x.|D]&}|j|t
�r)|||	<Pq)q)WqW|S(
s�
    Searches the registry for an image

    name
        Search keyword

    official : False
        Limit results to official builds

    trusted : False
        Limit results to `trusted builds`_

    **RETURN DATA**

    A dictionary with each key being the name of an image, and the following
    information for each image:

    - ``Description`` - Image description
    - ``Official`` - A boolean (``True`` if an official build, ``False`` if
      not)
    - ``Stars`` - Number of stars the image has on the registry
    - ``Trusted`` - A boolean (``True`` if a trusted build, ``False`` if not)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.search centos
        salt myminion docker.search centos official=True
    R�s)No images matched the search string '{0}'tDescriptiontdescriptiontOfficialtis_officialtTrustedt
is_trustedtStarst
star_countR�N(R�RR&R/RtR R#R�RR`R(
R�tofficialttrustedR�R�RRtR�R�R`t
mapped_keyRhRa((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s< 


%

c	C@s�td|�}i}x(t|d�D]\}}|||<q&Wg}xP|dD]D}i}x(t|�D]\}}||||<qjW|j|�qQW|S(sK
    Runs the `docker top` command on a specific container

    name
        Container name or ID

    CLI Example:


    **RETURN DATA**

    A list of dictionaries containing information about each process


    .. code-block:: bash

        salt myminion docker.top mycontainer
        salt myminion docker.top 0123456789ab
    ttoptTitlest	Processes(R�t	enumerateR/(	R�R�tcolumnstidxtcol_nameRhtprocesstcur_procRa((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�;	scC@s�td�}tjt�}d|kr�|jtj|d��}|r�tg|jd�j	d�D]}t
|�^qe�|d<q�nd|kr�|jtj|d��}|r�tg|jd�j	d�D]}t
|�^q��|d<q�n|S(s�
    Returns a dictionary of Docker version information. Equivalent to running
    the ``docker version`` Docker CLI command.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.version
    R"tVersioniRRt
ApiVersiontApiVersionInfo(R�R�R�t
VERSION_REtmatchRt	text_typettupletgroupR�R�(Rht
version_reR�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR"`	s>>cC@s3tjdj|��tdd�|j�D��S(Ns"creating networking config from {}tcreate_networking_configcS@s(i|]\}}td|�|�qS(tcreate_endpoint_config(R�(R�tktv((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pys
<dictcomp>	s	(R[R\R&R�titems(R((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR|	sc	K@sy|jdt�ot|�r2t|d|�ntd|d|d||�\}}|rutjdt|��ntjd|t	k	r�dj
|�nd	|�tj�}	td
|d||�}
tj�|	|
d<t
�|t	krt|
d
�djd�}n||
d<|ruyt|�Wn9tk
rg}tddi|
d6|j�d6��nXt|
d<n|
S(s�]
    Create a new container

    image
        Image from which to create the container

    name
        Name for the new container. If not provided, Docker will randomly
        generate one for you (it will be included in the return data).

    start : False
        If ``True``, start container after creating it

        .. versionadded:: 2018.3.0

    skip_translate
        This function translates Salt CLI or SLS input into the format which
        docker-py expects. However, in the event that Salt's translation logic
        fails (due to potential changes in the Docker Remote API, or to bugs in
        the translation code), this argument can be used to exert granular
        control over which arguments are translated and which are not.

        Pass this argument as a comma-separated list (or Python list) of
        arguments, and translation for each passed argument name will be
        skipped. Alternatively, pass ``True`` and *all* translation will be
        skipped.

        Skipping tranlsation allows for arguments to be formatted directly in
        the format which docker-py expects. This allows for API changes and
        other issues to be more easily worked around. An example of using this
        option to skip translation would be:

        .. code-block:: bash

            salt myminion docker.create image=centos:7.3.1611 skip_translate=environment environment="{'FOO': 'bar'}"

        See the following links for more information:

        - `docker-py Low-level API`_
        - `Docker Engine API`_

    ignore_collisions : False
        Since many of docker-py's arguments differ in name from their CLI
        counterparts (with which most Docker users are more familiar), Salt
        detects usage of these and aliases them to the docker-py version of
        that argument. However, if both the alias and the docker-py version of
        the same argument (e.g. ``env`` and ``environment``) are used, an error
        will be raised. Set this argument to ``True`` to suppress these errors
        and keep the docker-py version of the argument.

    validate_ip_addrs : True
        For parameters which accept IP addresses as input, IP address
        validation will be performed. To disable, set this to ``False``

    client_timeout : 60
        Timeout in seconds for the Docker client. This is not a timeout for
        this function, but for receiving a response from the API.

        .. note::

            This is only used if Salt needs to pull the requested image.

    **CONTAINER CONFIGURATION ARGUMENTS**

    auto_remove (or *rm*) : False
        Enable auto-removal of the container on daemon side when the
        container’s process exits (analogous to running a docker container with
        ``--rm`` on the CLI).

        Examples:

        - ``auto_remove=True``
        - ``rm=True``

    binds
        Files/directories to bind mount. Each bind mount should be passed in
        one of the following formats:

        - ``<host_path>:<container_path>`` - ``host_path`` is mounted within
          the container as ``container_path`` with read-write access.
        - ``<host_path>:<container_path>:<selinux_context>`` - ``host_path`` is
          mounted within the container as ``container_path`` with read-write
          access. Additionally, the specified selinux context will be set
          within the container.
        - ``<host_path>:<container_path>:<read_only>`` - ``host_path`` is
          mounted within the container as ``container_path``, with the
          read-only or read-write setting explicitly defined.
        - ``<host_path>:<container_path>:<read_only>,<selinux_context>`` -
          ``host_path`` is mounted within the container as ``container_path``,
          with the read-only or read-write setting explicitly defined.
          Additionally, the specified selinux context will be set within the
          container.

        ``<read_only>`` can be either ``ro`` for read-write access, or ``ro``
        for read-only access. When omitted, it is assumed to be read-write.

        ``<selinux_context>`` can be ``z`` if the volume is shared between
        multiple containers, or ``Z`` if the volume should be private.

        .. note::
            When both ``<read_only>`` and ``<selinux_context>`` are specified,
            there must be a comma before ``<selinux_context>``.

        Binds can be expressed as a comma-separated list or a Python list,
        however in cases where both ro/rw and an selinux context are specified,
        the binds *must* be specified as a Python list.

        Examples:

        - ``binds=/srv/www:/var/www:ro``
        - ``binds=/srv/www:/var/www:rw``
        - ``binds=/srv/www:/var/www``
        - ``binds="['/srv/www:/var/www:ro,Z']"``
        - ``binds="['/srv/www:/var/www:rw,Z']"``
        - ``binds=/srv/www:/var/www:Z``

        .. note::
            The second and third examples above are equivalent to each other,
            as are the last two examples.

    blkio_weight
        Block IO weight (relative weight), accepts a weight value between 10
        and 1000.

        Example: ``blkio_weight=100``

    blkio_weight_device
        Block IO weight (relative device weight), specified as a list of
        expressions in the format ``PATH:WEIGHT``

        Example: ``blkio_weight_device=/dev/sda:100``

    cap_add
        List of capabilities to add within the container. Can be passed as a
        comma-separated list or a Python list. Requires Docker 1.2.0 or
        newer.

        Examples:

        - ``cap_add=SYS_ADMIN,MKNOD``
        - ``cap_add="[SYS_ADMIN, MKNOD]"``

    cap_drop
        List of capabilities to drop within the container. Can be passed as a
        comma-separated string or a Python list. Requires Docker 1.2.0 or
        newer.

        Examples:

        - ``cap_drop=SYS_ADMIN,MKNOD``,
        - ``cap_drop="[SYS_ADMIN, MKNOD]"``

    command (or *cmd*)
        Command to run in the container

        Example: ``command=bash`` or ``cmd=bash``

        .. versionchanged:: 2015.8.1
            ``cmd`` is now also accepted

    cpuset_cpus (or *cpuset*)
        CPUs on which which to allow execution, specified as a string
        containing a range (e.g. ``0-3``) or a comma-separated list of CPUs
        (e.g. ``0,1``).

        Examples:

        - ``cpuset_cpus="0-3"``
        - ``cpuset="0,1"``

    cpuset_mems
        Memory nodes on which which to allow execution, specified as a string
        containing a range (e.g. ``0-3``) or a comma-separated list of MEMs
        (e.g. ``0,1``). Only effective on NUMA systems.

        Examples:

        - ``cpuset_mems="0-3"``
        - ``cpuset_mems="0,1"``

    cpu_group
        The length of a CPU period in microseconds

        Example: ``cpu_group=100000``

    cpu_period
        Microseconds of CPU time that the container can get in a CPU period

        Example: ``cpu_period=50000``

    cpu_shares
        CPU shares (relative weight), specified as an integer between 2 and 1024.

        Example: ``cpu_shares=512``

    detach : False
        If ``True``, run the container's command in the background (daemon
        mode)

        Example: ``detach=True``

    devices
        List of host devices to expose within the container

        Examples:

        - ``devices="/dev/net/tun,/dev/xvda1:/dev/xvda1,/dev/xvdb1:/dev/xvdb1:r"``
        - ``devices="['/dev/net/tun', '/dev/xvda1:/dev/xvda1', '/dev/xvdb1:/dev/xvdb1:r']"``

    device_read_bps
        Limit read rate (bytes per second) from a device, specified as a list
        of expressions in the format ``PATH:RATE``, where ``RATE`` is either an
        integer number of bytes, or a string ending in ``kb``, ``mb``, or
        ``gb``.

        Examples:

        - ``device_read_bps="/dev/sda:1mb,/dev/sdb:5mb"``
        - ``device_read_bps="['/dev/sda:100mb', '/dev/sdb:5mb']"``

    device_read_iops
        Limit read rate (I/O per second) from a device, specified as a list
        of expressions in the format ``PATH:RATE``, where ``RATE`` is a number
        of I/O operations.

        Examples:

        - ``device_read_iops="/dev/sda:1000,/dev/sdb:500"``
        - ``device_read_iops="['/dev/sda:1000', '/dev/sdb:500']"``

    device_write_bps
        Limit write rate (bytes per second) from a device, specified as a list
        of expressions in the format ``PATH:RATE``, where ``RATE`` is either an
        integer number of bytes, or a string ending in ``kb``, ``mb`` or
        ``gb``.


        Examples:

        - ``device_write_bps="/dev/sda:100mb,/dev/sdb:50mb"``
        - ``device_write_bps="['/dev/sda:100mb', '/dev/sdb:50mb']"``

    device_read_iops
        Limit write rate (I/O per second) from a device, specified as a list
        of expressions in the format ``PATH:RATE``, where ``RATE`` is a number
        of I/O operations.

        Examples:

        - ``device_read_iops="/dev/sda:1000,/dev/sdb:500"``
        - ``device_read_iops="['/dev/sda:1000', '/dev/sdb:500']"``

    dns
        List of DNS nameservers. Can be passed as a comma-separated list or a
        Python list.

        Examples:

        - ``dns=8.8.8.8,8.8.4.4``
        - ``dns="['8.8.8.8', '8.8.4.4']"``

        .. note::

            To skip IP address validation, use ``validate_ip_addrs=False``

    dns_opt
        Additional options to be added to the container’s ``resolv.conf`` file

        Example: ``dns_opt=ndots:9``

    dns_search
        List of DNS search domains. Can be passed as a comma-separated list
        or a Python list.

        Examples:

        - ``dns_search=foo1.domain.tld,foo2.domain.tld``
        - ``dns_search="[foo1.domain.tld, foo2.domain.tld]"``

    domainname
        The domain name to use for the container

        Example: ``domainname=domain.tld``

    entrypoint
        Entrypoint for the container. Either a string (e.g. ``"mycmd --arg1
        --arg2"``) or a Python list (e.g.  ``"['mycmd', '--arg1', '--arg2']"``)

        Examples:

        - ``entrypoint="cat access.log"``
        - ``entrypoint="['cat', 'access.log']"``

    environment (or *env*)
        Either a dictionary of environment variable names and their values, or
        a Python list of strings in the format ``VARNAME=value``.

        Examples:

        - ``environment='VAR1=value,VAR2=value'``
        - ``environment="['VAR1=value', 'VAR2=value']"``
        - ``environment="{'VAR1': 'value', 'VAR2': 'value'}"``

    extra_hosts
        Additional hosts to add to the container's /etc/hosts file. Can be
        passed as a comma-separated list or a Python list. Requires Docker
        1.3.0 or newer.

        Examples:

        - ``extra_hosts=web1:10.9.8.7,web2:10.9.8.8``
        - ``extra_hosts="['web1:10.9.8.7', 'web2:10.9.8.8']"``
        - ``extra_hosts="{'web1': '10.9.8.7', 'web2': '10.9.8.8'}"``

        .. note::

            To skip IP address validation, use ``validate_ip_addrs=False``

    group_add
        List of additional group names and/or IDs that the container process
        will run as

        Examples:

        - ``group_add=web,network``
        - ``group_add="['web', 'network']"``

    hostname
        Hostname of the container. If not provided, and if a ``name`` has been
        provided, the ``hostname`` will default to the ``name`` that was
        passed.

        Example: ``hostname=web1``

        .. warning::

            If the container is started with ``network_mode=host``, the
            hostname will be overridden by the hostname of the Minion.

    interactive (or *stdin_open*): False
        Leave stdin open, even if not attached

        Examples:

        - ``interactive=True``
        - ``stdin_open=True``

    ipc_mode (or *ipc*)
        Set the IPC mode for the container. The default behavior is to create a
        private IPC namespace for the container, but this option can be
        used to change that behavior:

        - ``container:<container_name_or_id>`` reuses another container shared
          memory, semaphores and message queues
        - ``host``: use the host's shared memory, semaphores and message queues

        Examples:

        - ``ipc_mode=container:foo``
        - ``ipc=host``

        .. warning::
            Using ``host`` gives the container full access to local shared
            memory and is therefore considered insecure.

    isolation
        Specifies the type of isolation technology used by containers

        Example: ``isolation=hyperv``

        .. note::
            The default value on Windows server is ``process``, while the
            default value on Windows client is ``hyperv``. On Linux, only
            ``default`` is supported.

    labels (or *label*)
        Add metadata to the container. Labels can be set both with and without
        values:

        Examples:

        - ``labels=foo,bar=baz``
        - ``labels="['foo', 'bar=baz']"``

        .. versionchanged:: 2018.3.0
            Labels both with and without values can now be mixed. Earlier
            releases only permitted one method or the other.

    links
        Link this container to another. Links should be specified in the format
        ``<container_name_or_id>:<link_alias>``. Multiple links can be passed,
        ether as a comma separated list or a Python list.

        Examples:

        - ``links=web1:link1,web2:link2``,
        - ``links="['web1:link1', 'web2:link2']"``
        - ``links="{'web1': 'link1', 'web2': 'link2'}"``

    log_driver
        Set container's logging driver. Requires Docker 1.6 or newer.

        Example:

        - ``log_driver=syslog``

        .. note::
            The logging driver feature was improved in Docker 1.13 introducing
            option name changes. Please see Docker's `Configure logging
            drivers`_ documentation for more information.

        .. _`Configure logging drivers`: https://docs.docker.com/engine/admin/logging/overview/

    log_opt
        Config options for the ``log_driver`` config option. Requires Docker
        1.6 or newer.

        Example:

        - ``log_opt="syslog-address=tcp://192.168.0.42,syslog-facility=daemon"``
        - ``log_opt="['syslog-address=tcp://192.168.0.42', 'syslog-facility=daemon']"``
        - ``log_opt="{'syslog-address': 'tcp://192.168.0.42', 'syslog-facility': 'daemon'}"``

    lxc_conf
        Additional LXC configuration parameters to set before starting the
        container.

        Examples:

        - ``lxc_conf="lxc.utsname=docker,lxc.arch=x86_64"``
        - ``lxc_conf="['lxc.utsname=docker', 'lxc.arch=x86_64']"``
        - ``lxc_conf="{'lxc.utsname': 'docker', 'lxc.arch': 'x86_64'}"``

        .. note::

            These LXC configuration parameters will only have the desired
            effect if the container is using the LXC execution driver, which
            has been deprecated for some time.

    mac_address
        MAC address to use for the container. If not specified, a random MAC
        address will be used.

        Example: ``mac_address=01:23:45:67:89:0a``

    mem_limit (or *memory*) : 0
        Memory limit. Can be specified in bytes or using single-letter units
        (i.e. ``512M``, ``2G``, etc.). A value of ``0`` (the default) means no
        memory limit.

        Examples:

        - ``mem_limit=512M``
        - ``memory=1073741824``

    mem_swappiness
        Tune a container's memory swappiness behavior. Accepts an integer
        between 0 and 100.

        Example: ``mem_swappiness=60``

    memswap_limit (or *memory_swap*) : -1
        Total memory limit (memory plus swap). Set to ``-1`` to disable swap. A
        value of ``0`` means no swap limit.

        Examples:

        - ``memswap_limit=1G``
        - ``memory_swap=2147483648``

    network_disabled : False
        If ``True``, networking will be disabled within the container

        Example: ``network_disabled=True``

    network_mode : bridge
        One of the following:

        - ``bridge`` - Creates a new network stack for the container on the
          docker bridge
        - ``none`` - No networking (equivalent of the Docker CLI argument
          ``--net=none``). Not to be confused with Python's ``None``.
        - ``container:<name_or_id>`` - Reuses another container's network stack
        - ``host`` - Use the host's network stack inside the container

          .. warning::
              Using ``host`` mode gives the container full access to the hosts
              system's services (such as D-Bus), and is therefore considered
              insecure.

        Examples:

        - ``network_mode=null``
        - ``network_mode=container:web1``

    oom_kill_disable
        Whether to disable OOM killer

        Example: ``oom_kill_disable=False``

    oom_score_adj
        An integer value containing the score given to the container in order
        to tune OOM killer preferences

        Example: ``oom_score_adj=500``

    pid_mode
        Set to ``host`` to use the host container's PID namespace within the
        container. Requires Docker 1.5.0 or newer.

        Example: ``pid_mode=host``

    pids_limit
        Set the container's PID limit. Set to ``-1`` for unlimited.

        Example: ``pids_limit=2000``

    port_bindings (or *publish*)
        Bind exposed ports which were exposed using the ``ports`` argument to
        :py:func:`docker.create <salt.modules.dockermod.create>`. These
        should be passed in the same way as the ``--publish`` argument to the
        ``docker run`` CLI command:

        - ``ip:hostPort:containerPort`` - Bind a specific IP and port on the
          host to a specific port within the container.
        - ``ip::containerPort`` - Bind a specific IP and an ephemeral port to a
          specific port within the container.
        - ``hostPort:containerPort`` - Bind a specific port on all of the
          host's interfaces to a specific port within the container.
        - ``containerPort`` - Bind an ephemeral port on all of the host's
          interfaces to a specific port within the container.

        Multiple bindings can be separated by commas, or passed as a Python
        list. The below two examples are equivalent:

        - ``port_bindings="5000:5000,2123:2123/udp,8080"``
        - ``port_bindings="['5000:5000', '2123:2123/udp', 8080]"``

        Port bindings can also include ranges:

        - ``port_bindings="14505-14506:4505-4506"``

        .. note::
            When specifying a protocol, it must be passed in the
            ``containerPort`` value, as seen in the examples above.

    ports
        A list of ports to expose on the container. Can be passed as
        comma-separated list or a Python list. If the protocol is omitted, the
        port will be assumed to be a TCP port.

        Examples:

        - ``ports=1111,2222/udp``
        - ``ports="[1111, '2222/udp']"``

    privileged : False
        If ``True``, runs the exec process with extended privileges

        Example: ``privileged=True``

    publish_all_ports (or *publish_all*): False
        Publish all ports to the host

        Example: ``publish_all_ports=True``

    read_only : False
        If ``True``, mount the container’s root filesystem as read only

        Example: ``read_only=True``

    restart_policy (or *restart*)
        Set a restart policy for the container. Must be passed as a string in
        the format ``policy[:retry_count]`` where ``policy`` is one of
        ``always``, ``unless-stopped``, or ``on-failure``, and ``retry_count``
        is an optional limit to the number of retries. The retry count is ignored
        when using the ``always`` or ``unless-stopped`` restart policy.

        Examples:

        - ``restart_policy=on-failure:5``
        - ``restart_policy=always``

    security_opt
        Security configuration for MLS systems such as SELinux and AppArmor.
        Can be passed as a comma-separated list or a Python list.

        Examples:

        - ``security_opt=apparmor:unconfined,param2:value2``
        - ``security_opt='["apparmor:unconfined", "param2:value2"]'``

        .. important::
            Some security options can contain commas. In these cases, this
            argument *must* be passed as a Python list, as splitting by comma
            will result in an invalid configuration.

        .. note::
            See the documentation for security_opt at
            https://docs.docker.com/engine/reference/run/#security-configuration

    shm_size
        Size of /dev/shm

        Example: ``shm_size=128M``

    stop_signal
        The signal used to stop the container. The default is ``SIGTERM``.

        Example: ``stop_signal=SIGRTMIN+3``

    stop_timeout
        Timeout to stop the container, in seconds

        Example: ``stop_timeout=5``

    storage_opt
        Storage driver options for the container

        Examples:

        - ``storage_opt='dm.basesize=40G'``
        - ``storage_opt="['dm.basesize=40G']"``
        - ``storage_opt="{'dm.basesize': '40G'}"``

    sysctls (or *sysctl*)
        Set sysctl options for the container

        Examples:

        - ``sysctl='fs.nr_open=1048576,kernel.pid_max=32768'``
        - ``sysctls="['fs.nr_open=1048576', 'kernel.pid_max=32768']"``
        - ``sysctls="{'fs.nr_open': '1048576', 'kernel.pid_max': '32768'}"``

    tmpfs
        A map of container directories which should be replaced by tmpfs
        mounts, and their corresponding mount options. Can be passed as Python
        list of PATH:VALUE mappings, or a Python dictionary. However, since
        commas usually appear in the values, this option *cannot* be passed as
        a comma-separated list.

        Examples:

        - ``tmpfs="['/run:rw,noexec,nosuid,size=65536k', '/var/lib/mysql:rw,noexec,nosuid,size=600m']"``
        - ``tmpfs="{'/run': 'rw,noexec,nosuid,size=65536k', '/var/lib/mysql': 'rw,noexec,nosuid,size=600m'}"``

    tty : False
        Attach TTYs

        Example: ``tty=True``

    ulimits (or *ulimit*)
        List of ulimits. These limits should be passed in the format
        ``<ulimit_name>:<soft_limit>:<hard_limit>``, with the hard limit being
        optional. Can be passed as a comma-separated list or a Python list.

        Examples:

        - ``ulimits="nofile=1024:1024,nproc=60"``
        - ``ulimits="['nofile=1024:1024', 'nproc=60']"``

    user
        User under which to run exec process

        Example: ``user=foo``

    userns_mode (or *user_ns_mode*)
        Sets the user namsepace mode, when the user namespace remapping option
        is enabled.

        Example: ``userns_mode=host``

    volumes (or *volume*)
        List of directories to expose as volumes. Can be passed as a
        comma-separated list or a Python list.

        Examples:

        - ``volumes=/mnt/vol1,/mnt/vol2``
        - ``volume="['/mnt/vol1', '/mnt/vol2']"``

    volumes_from
        Container names or IDs from which the container will get volumes. Can
        be passed as a comma-separated list or a Python list.

        Example: ``volumes_from=foo``, ``volumes_from=foo,bar``,
        ``volumes_from="[foo, bar]"``

    volume_driver
        Sets the container's volume driver

        Example: ``volume_driver=foobar``

    working_dir (or *workdir*)
        Working directory inside the container

        Examples:

        - ``working_dir=/var/log/nginx``
        - ``workdir=/var/www/myapp``

    **RETURN DATA**

    A dictionary containing the following keys:

    - ``Id`` - ID of the newly-created container
    - ``Name`` - Name of the newly-created container


    CLI Example:

    .. code-block:: bash

        # Create a data-only container
        salt myminion docker.create myuser/mycontainer volumes="/mnt/vol1,/mnt/vol2"
        # Create a CentOS 7 container that will stay running once started
        salt myminion docker.create centos:7 name=mycent7 interactive=True tty=True command=bash
    R@RrRRRsUThe following arguments were ignored because they are not recognized by docker-py: %ssEdocker.create: creating container %susing the following arguments: %sswith name '{0}' R�R
R�tTime_ElapsedR�R�R�s(Failed to start container after creationR�R�R�tStarted(RtRXR�R�RR[R�R�R\R R&R�R�R�RR|RRR�(timageR�RRRRRrR^t
unused_kwargsttime_startedR�Rg((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytcreate�	sH���	 
!
c
K@sI|
jdt�r2t|�r2t|d|�nd-}|d-k	r�ytd|�}Wntk
rkq�X|dkr�|o�|r�tdj|���q�|s�tdj|���q�t|d|�}ni}
xCt	d�dD]1}y|
j|�|
|<Wq�t
k
rq�Xq�W|
jd	d-�td
|d|d||
�\}
}|
jd
i�jdt
�}|r�tjdt|��n|	rt|	tj�r�d�|	jd�D�}	nt|	t�s�td�tj|	�D��rtd��qntjd|d-k	r'dj|�nd|
�tj�}td|d||
�}|rh||d<n|d-kr�t|d�djd�}n||d<d�}i|d6}y|	ryy<x5tj|	�D]$\}}td|d||�q�WWqytk
ru}|rZyt|�WqZtk
rV}|jd g�j d!j|��qZXnt|j!�d"|��qyXng}t"|d�|syJxCtd|dd	td#t
�D]"}|j t#j$j%j&|��q�WWqtk
rd$}|||�qXntj�||d%<t'�|s�dj(|�|d&<|s�yt|d�}Wntk
ru||d'�q�X|jd(i�}|jd)�}|d*kr�||d+�n|jd,�|d,<q�nWnutk
rD}y|j)|j*�Wn3t+t,fk
r(|jd g�j |j*�nXt|j!�d"|��nX|S(.s 
    .. versionadded:: 2018.3.0

    Equivalent to ``docker run`` on the Docker CLI. Runs the container, waits
    for it to exit, and returns the container's logs when complete.

    .. note::
        Not to be confused with :py:func:`docker.run
        <salt.modules.dockermod.run>`, which provides a :py:func:`cmd.run
        <salt.modules.cmdmod.run>`-like interface for executing commands in a
        running container.

    This function accepts the same arguments as :py:func:`docker.create
    <salt.modules.dockermod.create>`, with the exception of ``start``. In
    addition, it accepts the arguments from :py:func:`docker.logs
    <salt.modules.dockermod.logs>`, with the exception of ``follow``, to
    control how logs are returned. Finally, the ``bg`` argument described below
    can be used to optionally run the container in the background (the default
    behavior is to block until the container exits).

    bg : False
        If ``True``, this function will not wait for the container to exit and
        will not return its logs. It will however return the container's name
        and ID, allowing for :py:func:`docker.logs
        <salt.modules.dockermod.logs>` to be used to view the logs.

        .. note::
            The logs will be inaccessible once the container exits if
            ``auto_remove`` is set to ``True``, so keep this in mind.

    replace : False
        If ``True``, and if the named container already exists, this will
        remove the existing container. The default behavior is to return a
        ``False`` result when the container already exists.

    force : False
        If ``True``, and the named container already exists, *and* ``replace``
        is also set to ``True``, then the container will be forcibly removed.
        Otherwise, the state will not proceed and will return a ``False``
        result.

    networks
        Networks to which the container should be connected. If automatic IP
        configuration is being used, the networks can be a simple list of
        network names. If custom IP configuration is being used, then this
        argument must be passed as a dictionary.

    CLI Examples:

    .. code-block:: bash

        salt myminion docker.run_container myuser/myimage command=/usr/local/bin/myscript.sh
        # Run container in the background
        salt myminion docker.run_container myuser/myimage command=/usr/local/bin/myscript.sh bg=True
        # Connecting to two networks using automatic IP configuration
        salt myminion docker.run_container myuser/myimage command='perl /scripts/sync.py' networks=net1,net2
        # net1 using automatic IP, net2 using static IPv4 address
        salt myminion docker.run_container myuser/myimage command='perl /scripts/sync.py' networks='{"net1": {}, "net2": {"ipv4_address": "192.168.27.12"}}'
    R@Rrsdocker.stateRnswContainer '{0}' exists and is running. Run with replace=True and force=True to force removal of the existing container.sNContainer '{0}' exists. Run with replace=True to remove the existing containertforceR�R�RRRRt
AutoRemovesUThe following arguments were ignored because they are not recognized by docker-py: %scS@si|]}i|�qS(((R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pys
<dictcomp>
s	t,cs@s|]}t|t�VqdS(N(R�RI(R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pys	<genexpr>	
ss$Invalid format for networks argumentsEdocker.create: creating container %susing the following arguments: %sswith name '{0}' R�R
R�tReplacesR�R�R�cS@sc|jdd�}|dkr*|g}n+t|t�rI|j|�n||g}||d<dS(NtWarnings(RtR R�R�R/(RhR�twarnings((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_append_warning
streturns#docker.connect_container_to_networktother_errorss$Failed to auto_remove container: {0}R�t
timestampss�Failed to get logs from container. This may be because the container exited before Salt was able to attach to it to retrieve the logs. Consider setting auto_remove to False.R�tLogss)Failed to inspect container after runningRjR�texitedsContainer state is not 'exited'tExitCodeN(-RtRXR�R�R RPRR&RRR�RR#RR[R�R�R�Rtstring_typesR�RIRRVRR\R�R�RR|R`R�R/R�RRSRTR�R�R�R'RR�R�RM(R�R�RRRRrtbgR�R�RR^tremoved_idst	pre_statet
log_kwargstargnameR�tauto_removeR�RhRRR3tnet_confRgtrm_excR�R4R�Rctcstatetcstatus((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt
run_container�s�G

	
 
	

	

$

 cC@s�t|�}|dkr0tdj|���ntjj|�sQtd��ntjj|�r�tjj|tjj	|��}|}n�tjj
|�d}tjj|�s|r�ytj|�Wqtk
r�}tdj||���qXqtdj|���n|rFtjj
|�rFtdj|���ntjj|�sgtd��n�t|d	jtj|��d
t�dkr�t|djtj|��d
t�dkr�td��q�ntd
j|���t||�}|td|d�kr*tjd|||�tStjd|||�ydj||f�}	Wn#tk
r~dj||�}	nXdd|	|g}
td|
dt�|td|d�kS(s;
    Copy a file from inside a container to the Minion

    name
        Container name

    source
        Path of the file on the container's filesystem

    dest
        Destination on the Minion. Must be an absolute path. If the destination
        is a directory, the file will be copied into that directory.

    overwrite : False
        Unless this option is set to ``True``, then if a file exists at the
        location specified by the ``dest`` argument, an error will be raised.

    makedirs : False
        Create the parent directory on the container if it does not already
        exist.


    **RETURN DATA**

    A boolean (``True`` if successful, otherwise ``False``)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.copy_from mycontainer /var/log/nginx/access.log /home/myuser
    RnsContainer '{0}' is not runnings!Destination path must be absoluteis-Unable to make destination directory {0}: {1}sDirectory {0} does not existsGDestination path {0} already exists. Use overwrite=True to overwrite itsSource path must be absolutestest -e {0}R�stest -f {0}sSource must be a regular filesSource file {0} does not existsfile.get_sumtmd5s-%s:%s and %s are the same file, skipping copys/Copying %s from container '%s' to local path %st:s{0}:{1}Rtcpscmd.runRA(R�RR&RQR�tisabsRtisdirR'tbasenameR�tmakedirstOSErrorR�ReR�R�RXR�RPR[R\R�R(R�tsourcetdestt	overwriteRR�tdest_dirRgt
source_md5tsrc_pathRv((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt	copy_fromw
sf"!	


RcC@sN|dkrt�}ntd|td|�|dtd|d|d|�S(s
    Copy a file from the host into a container

    name
        Container name

    source
        File to be copied to the container. Can be a local path on the Minion
        or a remote file from the Salt fileserver.

    dest
        Destination on the container. Must be an absolute path. If the
        destination is a directory, the file will be copied into that
        directory.

    exec_driver : None
        If not passed, the execution driver will be detected as described
        :ref:`above <docker-execution-driver>`.

    overwrite : False
        Unless this option is set to ``True``, then if a file exists at the
        location specified by the ``dest`` argument, an error will be raised.

    makedirs : False
        Create the parent directory on the container if it does not already
        exist.


    **RETURN DATA**

    A boolean (``True`` if successful, otherwise ``False``)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.copy_to mycontainer /tmp/foo /root/foo
    scontainer_resource.copy_toscontainer_resource.cache_filetcontainer_typetexec_driverR"RN(R R�RPR%(R�R R!R(R"R((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytcopy_to�
s-
c
K@s\dj|�}y%tjj|�s3t|��nWntk
rSt|��nXtjj|�r�|r�tdj|���n|dkr|j	d�s�|j	d�r�d}q]|j	d�s�|j	d�r�d}q]|j	d	�s�|j	d
�r]t
rd}qtd��q]n?|d
kr3d}n*|dkrHd}n|dkr]d}n|r�|d!kr�tdj|���ntjj|�}tjj|�s|s�tdj|���nytj
|�Wqtk
r}tdj||���qXn|dkr^ytj|d�}	Wq�tk
rZ}tdj||���q�Xn6|dkrytj�}
n|dkr�tj�}
ntj�}z6y�|dkr�td|d�}	ntd|�}d}
xi|
dkrH|jd�}
|
r�|d"kr5|
j|
�}|rB|	j|�qBqE|	j|
�q�q�W|d#krz|
j�}|rz|	j|�qzn|	j�WnMtk
r�}ytj|�Wntk
r�nXtdj|���nXWd|	j�Xitj�|d6}||d<tj|�j |d<t!|d�|d<|j"t#t$�rXt%d|�|d <n|S($sv
    Exports a container to a tar archive. It can also optionally compress that
    tar archive, and push it up to the Master.

    name
        Container name or ID

    path
        Absolute path on the Minion where the container will be exported

    overwrite : False
        Unless this option is set to ``True``, then if a file exists at the
        location specified by the ``path`` argument, an error will be raised.

    makedirs : False
        If ``True``, then if the parent directory of the file specified by the
        ``path`` argument does not exist, Salt will attempt to create it.

    compression : None
        Can be set to any of the following:

        - ``gzip`` or ``gz`` for gzip compression
        - ``bzip2`` or ``bz2`` for bzip2 compression
        - ``xz`` or ``lzma`` for XZ compression (requires `xz-utils`_, as well
          as the ``lzma`` module from Python 3.3, available in Python 2 and
          Python 3.0-3.2 as `backports.lzma`_)

        This parameter can be omitted and Salt will attempt to determine the
        compression type by examining the filename passed in the ``path``
        parameter.

        .. _`xz-utils`: http://tukaani.org/xz/
        .. _`backports.lzma`: https://pypi.python.org/pypi/backports.lzma

    push : False
        If ``True``, the container will be pushed to the master using
        :py:func:`cp.push <salt.modules.cp.push>`.

        .. note::

            This requires :conf_master:`file_recv` to be set to ``True`` on the
            Master.


    **RETURN DATA**

    A dictionary will containing the following keys:

    - ``Path`` - Path of the file that was exported
    - ``Push`` - Reports whether or not the file was successfully pushed to the
      Master

      *(Only present if push=True)*
    - ``Size`` - Size of the file, in bytes
    - ``Size_Human`` - Size of the file, in human-readable units
    - ``Time_Elapsed`` - Time in seconds taken to perform the export


    CLI Examples:

    .. code-block:: bash

        salt myminion docker.export mycontainer /tmp/mycontainer.tar
        salt myminion docker.export mycontainer /tmp/mycontainer.tar.xz push=True
    sPath '{0}' is not absolutes{0} already existss.tar.gzs.tgztgzips.tar.bz2s.tbz2tbzip2s.tar.xzs.txztxzsdXZ compression unavailable. Install the backports.lzma module and xz-utils to enable XZ compression.tgztbz2tlzmasInvalid compression type '{0}'sRParent dir {0} of destination path does not exist. Use makedirs=True to create it.s"Unable to make parent dir {0}: {1}twbs#Unable to open {0} for writing: {1}sfiles.fopentexportR�is+Error occurred during container export: {0}NR�R�R�t
Size_Humanscp.pushtPush(sgzipR+R,(R+R,(R+R,(&R&RQR�RRR;R�RR RqtHAS_LZMAtdirnameRRRR*topenR.t
BZ2CompressorR/tLZMACompressorR�RsR�treadtcompresstwritetflushRRLtclosetstattst_sizeR�R#R�RRP(R�R�R"RtcompressionR^R�t
parent_dirRgtoutt
compressorR�R�tbufR�Rh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR1#s�G
						

c

K@sNtd|�}|jdt�}|jdd�}t}|rQtd|�nt|�dkr�|pl|r�tdj|���n|r�|r�t|�}y|dd}Wn!tk
r�t	j
d	|�nXt|d|�ntd
t
�}|std|d|d
|�nt�g|D]!}	|	td
t
�kr)|	^q)S(sv
    Removes a container

    name
        Container name or ID

    force : False
        If ``True``, the container will be killed first before removal, as the
        Docker API will not permit a running container to be removed. This
        option is set to ``False`` by default to prevent accidental removal of
        a running container.

    stop : False
        If ``True``, the container will be stopped first before removal, as the
        Docker API will not permit a running container to be removed. This
        option is set to ``False`` by default to prevent accidental removal of
        a running container.

        .. versionadded:: 2017.7.0

    timeout
        Optional timeout to be passed to :py:func:`docker.stop
        <salt.modules.dockermod.stop>` if stopping the container.

        .. versionadded:: 2018.3.0

    volumes : False
        Also remove volumes associated with container


    **RETURN DATA**

    A list of the IDs of containers which were removed


    CLI Example:

    .. code-block:: bash

        salt myminion docker.rm mycontainer
        salt myminion docker.rm mycontainer force=True
    sargs.clean_kwargststopR<sargs.invalid_kwargsRnsLContainer '{0}' is running, use force=True to forcibly remove this containerRRs[Failed to find AutoRemove in inspect results, Docker API may have changed. Full results: %sRtremove_containerR�R�N(RsRtRR R�RR&RR�R[R�RER
RXR�R�(
R�R�tvolumesR^tstop_R<RRpR�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�s0,

cC@sJt|�d}tjd|||�td||�t|�d|kS(s�
    .. versionadded:: 2017.7.0

    Renames a container. Returns ``True`` if successful, and raises an error if
    the API returns one. If unsuccessful and the API returns no error (should
    not happen), then ``False`` will be returned.

    name
        Name or ID of existing container

    new_name
        New name to assign to container

    CLI Example:

    .. code-block:: bash

        salt myminion docker.rename foo bar
    R�s(Renaming container '%s' (ID: %s) to '%s'trename(RR[R\R�(R�tnew_nameR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRI"sc
C@s�t�|	dk	r-tddd�|	}
n|s9|r�|rU|rUtd��q�t|tj�sytj|�}nt|tj�s�tj|�}q�n|r�|r�dj||�nd}t	j	�}t
dd|d|d	td
|d|d|d
|d|�}
it	j	�|d6}t�|
sIt
dj|���ng}x0|
D](}|jtjjj|dt��qVWg}x�|D]�}ytt|��}Wntk
r�q�nX|dkr�t||�n|dkr�t||�q�|dkr�t||�q�q�Wd|kr�dj|�}tj|�tj|�|rt|djdj|��7}nt
|��nt|ddt�}|r�||d<ndj|�|d<|r�||d<n|r�|jdd�n|S( s�
    .. versionchanged:: 2018.3.0
        If the built image should be tagged, then the repository and tag must
        now be passed separately using the ``repository`` and ``tag``
        arguments, rather than together in the (now deprecated) ``image``
        argument.

    Builds a docker image from a Dockerfile or a URL

    path
        Path to directory on the Minion containing a Dockerfile

    repository
        Optional repository name for the image being built

        .. versionadded:: 2018.3.0

    tag : latest
        Tag name for the image (required if ``repository`` is passed)

        .. versionadded:: 2018.3.0

    image
        .. deprecated:: 2018.3.0
            Use both ``repository`` and ``tag`` instead

    cache : True
        Set to ``False`` to force the build process not to use the Docker image
        cache, and pull all required intermediate image layers

    rm : True
        Remove intermediate containers created during build

    api_response : False
        If ``True``: an ``API_Response`` key will be present in the return
        data, containing the raw output from the Docker API.

    fileobj
        Allows for a file-like object containing the contents of the Dockerfile
        to be passed in place of a file ``path`` argument. This argument should
        not be used from the CLI, only from other Salt code.

    dockerfile
        Allows for an alternative Dockerfile to be specified. Path to
        alternative Dockefile is relative to the build path for the Docker
        container.

        .. versionadded:: 2016.11.0

    buildargs
        A dictionary of build arguments provided to the docker build process.


    **RETURN DATA**

    A dictionary containing one or more of the following keys:

    - ``Id`` - ID of the newly-built image
    - ``Time_Elapsed`` - Time in seconds taken to perform the build
    - ``Intermediate_Containers`` - IDs of containers created during the course
      of the build process

      *(Only present if rm=False)*
    - ``Images`` - A dictionary containing one or more of the following keys:
        - ``Already_Pulled`` - Layers that that were already present on the
          Minion
        - ``Pulled`` - Layers that that were pulled

      *(Only present if the image specified by the "repository" and "tag"
      arguments was not present on the Minion, or if cache=False)*
    - ``Status`` - A string containing a summary of the pull action (usually a
      message saying that an image was downloaded, or that it was up to date).

      *(Only present if the image specified by the "repository" and "tag"
      arguments was not present on the Minion, or if cache=False)*


    CLI Example:

    .. code-block:: bash

        salt myminion docker.build /path/to/docker/build/dir
        salt myminion docker.build https://github.com/myuser/myrepo.git repository=myimage tag=latest
        salt myminion docker.build /path/to/docker/build/dir dockerfile=Dockefile.different repository=myimage tag=dev
    sversions.warn_untilR�sZThe 'image' argument to docker.build has been deprecated, please use 'repository' instead.s2If tagging, both a repository and tag are requireds{0}:{1}tbuildR�RRmtfileobjRtnocachet
dockerfilet	buildargsR�s:Build failed for {0}, no response returned from Docker APItclsR�R�R�R�sBuild failed for {0}s. Error(s) follow:

{0}s

RR�sFailed to tag image as {0}tWarningtAPI_ResponseR�N( R�R RsRR�RRR�R&R�R�RR�RR{RSRTRURVR,tnexttitert
StopIterationR�R�RR[R�R'R�RXRt(R�t
repositoryRtcacheRtapi_responseRLRNROR�trespositoryt	image_tagR�R�Rhtstream_dataR4R�R�t	item_typeR�tresolved_tag((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRK?s~_	
$		
&



	

tlatestcC@s#|dk	r&tddd�|}nt|tj�sJtj|�}nt|tj�sntj|�}ntj�}td|d|d|d|d|�}itj�|d	6}	t�d}
x(dD] }||kr�||}
Pq�q�W|
dkrt	d
��n||	d<|
|	d
<|	S(sq
    .. versionchanged:: 2018.3.0
        The repository and tag must now be passed separately using the
        ``repository`` and ``tag`` arguments, rather than together in the (now
        deprecated) ``image`` argument.

    Commits a container, thereby promoting it to an image. Equivalent to
    running the ``docker commit`` Docker CLI command.

    name
        Container name or ID to commit

    repository
        Repository name for the image being committed

        .. versionadded:: 2018.3.0

    tag : latest
        Tag name for the image

        .. versionadded:: 2018.3.0

    image
        .. deprecated:: 2018.3.0
            Use both ``repository`` and ``tag`` instead

    message
        Commit message (Optional)

    author
        Author name (Optional)


    **RETURN DATA**

    A dictionary containing the following keys:

    - ``Id`` - ID of the newly-created image
    - ``Image`` - Name of the newly-created image
    - ``Time_Elapsed`` - Time in seconds taken to perform the commit


    CLI Example:

    .. code-block:: bash

        salt myminion docker.commit mycontainer myuser/myimage mytag
    sversions.warn_untilR�s[The 'image' argument to docker.commit has been deprecated, please use 'repository' instead.tcommitRVRRtauthorR�R�R�tIDs(No image ID was returned in API responseR�N(sIdsidRa(
R RsR�RRR�R�R�R�R(R�RVRRR`R�RYR�R�RhR}R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR_�s:6		



c	C@s�tdt�}gt|�D]$}||ddkr|d ^q}|sP|Si}x�|D]}y&t|d|�|j|i�d<Wq]tk
r�}|j�}tj	|�||j|i�d<t
||d<q]Xq]W|S(s�
    Return top-level images (those on which no other images depend) which do
    not have a tag assigned to them. These include:

    - Images which were once tagged but were later untagged, such as those
      which were superseded by committing a new copy of an existing tagged
      image.
    - Images which were loaded using :py:func:`docker.load
      <salt.modules.dockermod.load>` (or the ``docker load`` Docker CLI
      command), but not tagged.

    prune : False
        Remove these images

    force : False
        If ``True``, and if ``prune=True``, then forcibly remove these images.

    **RETURN DATA**

    If ``prune=False``, the return data will be a list of dangling image IDs.

    If ``prune=True``, the return data will be a dictionary with each key being
    the ID of the dangling image, and the following information for each image:

    - ``Comment`` - Any error encountered when trying to prune a dangling image

      *(Only present if prune failed)*
    - ``Removed`` - A boolean (``True`` if prune was successful, ``False`` if
      not)


    CLI Example:

    .. code-block:: bash

        salt myminion docker.dangling
        salt myminion docker.dangling prune=True
    RR�iR�tRemovedtCommentN(R�RXR�R trmiR�RR�R[R�R(	tpruneR�t
all_imagesR�tdangling_imagesRhR�RgR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytdanglingTs'$
&
cC@s�|dk	r&tddd�|}nt|tj�sJtj|�}nt|tj�sntj|�}ntd|�}tj�}td|d|d|�}itj�|d6}	t	�|s�t
d	j|���n|r�||	d
<ng}
xy|D]q}ytt
|��}Wntk
r3qnX|dkrVt|	|||�q|dkrt|
|�qqWd
|	kr�dj|�}
|
r�|
djdj|
��7}
nt
|
��n|	S(sd
    .. versionchanged:: 2018.3.0
        The repository and tag must now be passed separately using the
        ``repository`` and ``tag`` arguments, rather than together in the (now
        deprecated) ``image`` argument.

    Imports content from a local tarball or a URL as a new docker image

    source
        Content to import (URL or absolute path to a tarball).  URL can be a
        file on the Salt fileserver (i.e.
        ``salt://path/to/rootfs/tarball.tar.xz``. To import a file from a
        saltenv other than ``base`` (e.g. ``dev``), pass it at the end of the
        URL (ex. ``salt://path/to/rootfs/tarball.tar.xz?saltenv=dev``).

    repository
        Repository name for the image being imported

        .. versionadded:: 2018.3.0

    tag : latest
        Tag name for the image

        .. versionadded:: 2018.3.0

    image
        .. deprecated:: 2018.3.0
            Use both ``repository`` and ``tag`` instead

    api_response : False
        If ``True`` an ``api_response`` key will be present in the return data,
        containing the raw output from the Docker API.


    **RETURN DATA**

    A dictionary containing the following keys:

    - ``Id`` - ID of the newly-created image
    - ``Image`` - Name of the newly-created image
    - ``Time_Elapsed`` - Time in seconds taken to perform the commit


    CLI Example:

    .. code-block:: bash

        salt myminion docker.import /tmp/cent7-minimal.tar.xz myuser/centos
        salt myminion docker.import /tmp/cent7-minimal.tar.xz myuser/centos:7
        salt myminion docker.import salt://dockerimages/cent7-minimal.tar.xz myuser/centos:7
    sversions.warn_untilR�s[The 'image' argument to docker.import has been deprecated, please use 'repository' instead.scontainer_resource.cache_filetimport_imageRVRR�s;Import failed for {0}, no response returned from Docker APIRRR�R�R�sImport failed for {0}s. Error(s) follow:

{0}s

N(R RsR�RRR�RPR�R�R�RR&RSRTRUR�RR'(R RVRRXR�RYR�R�R�RhR�R�R\R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�sP8		


	c
C@ss|d k	r&tddd�|}n|s2|rN|o;|rNtd��ntd|�}tjj|�s�tdj|���nt	dt
�}dd	d
|g}tj�}td|�}	itj�|d6}
t�t	dt
�}|	d
dkrDdj|�}|	dr5|dj|	d�7}nt|��n||
d<g|D]}
|
|krU|
^qU}g|D]}
|
d ^qz|
d<t
|d|�}|s�|rot|�dkr�djdj|��|
d<qodj||�}y*t|dd|d|�}	||
d<Wqotk
r<d|
d<qotk
rk}dj|d||�|
d<qoXn|
S(!s�
    .. versionchanged:: 2018.3.0
        If the loaded image should be tagged, then the repository and tag must
        now be passed separately using the ``repository`` and ``tag``
        arguments, rather than together in the (now deprecated) ``image``
        argument.

    Load a tar archive that was created using :py:func:`docker.save
    <salt.modules.dockermod.save>` (or via the Docker CLI using ``docker save``).

    path
        Path to docker tar archive. Path can be a file on the Minion, or the
        URL of a file on the Salt fileserver (i.e.
        ``salt://path/to/docker/saved/image.tar``). To load a file from a
        saltenv other than ``base`` (e.g. ``dev``), pass it at the end of the
        URL (ex. ``salt://path/to/rootfs/tarball.tar.xz?saltenv=dev``).

    repository
        If specified, the topmost layer of the newly-loaded image will be
        tagged with the specified repo using :py:func:`docker.tag
        <salt.modules.dockermod.tag_>`. If a repository name is provided, then
        the ``tag`` argument is also required.

        .. versionadded:: 2018.3.0

    tag
        Tag name to go along with the repository name, if the loaded image is
        to be tagged.

        .. versionadded:: 2018.3.0

    image
        .. deprecated:: 2018.3.0
            Use both ``repository`` and ``tag`` instead


    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``Path`` - Path of the file that was saved
    - ``Layers`` - A list containing the IDs of the layers which were loaded.
      Any layers in the file that was loaded, which were already present on the
      Minion, will not be included.
    - ``Image`` - Name of tag applied to topmost layer

      *(Only present if tag was specified and tagging was successful)*
    - ``Time_Elapsed`` - Time in seconds taken to load the file
    - ``Warning`` - Message describing any problems encountered in attemp to
      tag the topmost layer

      *(Only present if tag was specified and tagging failed)*


    CLI Example:

    .. code-block:: bash

        salt myminion docker.load /path/to/image.tar
        salt myminion docker.load salt://path/to/docker/saved/image.tar repository=myuser/myimage tag=mytag
    sversions.warn_untilR�sYThe 'image' argument to docker.load has been deprecated, please use 'repository' instead.s2If tagging, both a repository and tag are requiredscontainer_resource.cache_filesSource file {0} does not existRRtloads-iscmd.run_allR�Reis Failed to load image(s) from {0}Rns: {0}R�iR�R�isIMore than one top-level image layer was loaded ({0}), no image was taggeds, RQs{0}:{1}RVRR�s:No top-level image layers were loaded, no image was taggedsFailed to tag {0} as {1}: {2}N(R RsRRPRQR�tisfileRR&R�RXR�R�R�tlenR'RR�R(R�RVRR�RYt
local_pathR�RvR�R�RhR�R�R�t
new_layersttop_level_imagesttagged_imageRg((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRj�sX>	

%!
	

cC@stg}ddd|g}x7ttd|dt�j��D]}|j|�q;W|sptdj|���n|S(s&
    Returns a list of the IDs of layers belonging to the specified image, with
    the top-most layer (the one correspnding to the passed name) appearing
    last.

    name
        Image name or ID

    CLI Example:

    .. code-block:: bash

        salt myminion docker.layers centos:7
    RR�s-qscmd.run_stdoutRAsImage '{0}' not found(R�RPRR-R/RR&(R�RhRvR4((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytlayers~s#cC@s�t�itd6|d6}|r.||d<ntj�}td||�}itj�|d6dd6}t�|s�tdj|���n|r�||d	<ng}x�|D]�}	tjd
|	�yt	j
jj|	�}	Wn;t
k
r}
tdj|	�di|
j�d
6��nXytt|	��}Wntk
rHq�nX|dkret||	�q�|dkr�t||	�q�q�W|r�||d<d|d<n|S(s%
    .. versionchanged:: 2018.3.0
        If no tag is specified in the ``image`` argument, all tags for the
        image will be pulled. For this reason is it recommended to pass
        ``image`` using the ``repo:tag`` notation.

    Pulls an image from a Docker registry

    image
        Image to be pulled

    insecure_registry : False
        If ``True``, the Docker client will permit the use of insecure
        (non-HTTPS) registries.

    api_response : False
        If ``True``, an ``API_Response`` key will be present in the return
        data, containing the raw output from the Docker API.

        .. note::

            This may result in a **lot** of additional return data, especially
            for larger images.

    client_timeout
        Timeout in seconds for the Docker client. This is not a timeout for
        this function, but for receiving a response from the API.


    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``Layers`` - A dictionary containing one or more of the following keys:
        - ``Already_Pulled`` - Layers that that were already present on the
          Minion
        - ``Pulled`` - Layers that that were pulled
    - ``Status`` - A string containing a summary of the pull action (usually a
      message saying that an image was downloaded, or that it was up to date).
    - ``Time_Elapsed`` - Time in seconds taken to perform the pull


    CLI Example:

    .. code-block:: bash

        salt myminion docker.pull centos
        salt myminion docker.pull centos:6
    R�Rrtinsecure_registryR�R�iRes9Pull failed for {0}, no response returned from Docker APIRRspull event: %ss$Unable to interpret API event: '{0}'R�tErrorR�R�Rfi(R�RXR�R�R�RR&R[R\RSRTRURVRR�RSRTRUR�R(R�RrRXRrR^R�R�RhR�teventRgt
event_type((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��sH5







cC@s�t|tj�s$tj|�}nitd6|d6}|rK||d<ntj�}td||�}itj�|d6dd6}t�|s�tdj	|���n|r�||d	<ng}x�|D]�}	yt
jjj
|	�}	Wn;tk
r(}
td
j	|	�di|
j�d6��nXytt|	��}Wntk
rUq�nX|d
krrt||	�q�|dkr�t||	�q�q�W|r�||d<d|d<n|S(s
    .. versionchanged:: 2015.8.4
        The ``Id`` and ``Image`` keys are no longer present in the return data.
        This is due to changes in the Docker Remote API.

    Pushes an image to a Docker registry. See the documentation at top of this
    page to configure authentication credentials.

    image
        Image to be pushed. If just the repository name is passed, then all
        tagged images for the specified repo will be pushed. If the image name
        is passed in ``repo:tag`` notation, only the specified image will be
        pushed.

    insecure_registry : False
        If ``True``, the Docker client will permit the use of insecure
        (non-HTTPS) registries.

    api_response : False
        If ``True``, an ``API_Response`` key will be present in the return
        data, containing the raw output from the Docker API.

    client_timeout
        Timeout in seconds for the Docker client. This is not a timeout for
        this function, but for receiving a response from the API.


    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``Layers`` - A dictionary containing one or more of the following keys:
        - ``Already_Pushed`` - Layers that that were already present on the
          Minion
        - ``Pushed`` - Layers that that were pushed
    - ``Time_Elapsed`` - Time in seconds taken to perform the push


    CLI Example:

    .. code-block:: bash

        salt myminion docker.push myuser/mycontainer
        salt myminion docker.push myuser/mycontainer:mytag
    R�RrRrR�R�iRes9Push failed for {0}, no response returned from Docker APIRRs$Unable to interpret API event: '{0}'R�RsR�R�Rfi(R�RRR�RXR�R�R�RR&RSRTRURVRR�RSRTRUR�R(R�RrRXRrR^R�R�RhR�RtRgRu((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��sH1







c
O@stdt�}t�}|jdt�}|jdt�}g}xK|D]C}t|�d}y#td|d|d|dt�WqJtjj	k
r�}	|	j
jdkrg|j|	j
�t|�}
|
d	s�|
d
r�d}|
d	r|djd
j|
d	��7}n|
d
rT|
d	r1|d7}n|djd
j|
d
��7}n|j|�q�q�|jdj|	j
j|	j
��qJXqJWt�ig|D]!}|tdt�kr�|^q�d6g|D]}|t�kr�|^q�d6dd6}
|r||
d<d|
d<n|
S(s;
    Removes an image

    name
        Name (in ``repo:tag`` notation) or ID of image.

    force : False
        If ``True``, the image will be removed even if the Minion has
        containers created from that image

    prune : True
        If ``True``, untagged parent image layers will be removed as well, set
        this to ``False`` to keep them.


    **RETURN DATA**

    A dictionary will be returned, containing the following two keys:

    - ``Layers`` - A list of the IDs of image layers that were removed
    - ``Tags`` - A list of the tags that were removed
    - ``Errors`` - A list of any errors that were encountered


    CLI Examples:

    .. code-block:: bash

        salt myminion docker.rmi busybox
        salt myminion docker.rmi busybox force=True
        salt myminion docker.rmi foo bar baz
    RR�ReR�tremove_imagetnopruneR�i�R0RzsImage is in use by scontainer(s): {0}s, s and s
image(s): {0}sError {0}: {1}R�tTagsiReRfi(R�RXR�R#RR R�RR�R�R�R�R/R�R�R&R'R�(R�R^t
pre_imagestpre_tagsR�RwR�R�R}RgtdepsR�R�Rh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRdYsJ!	

	


#2)


c
K@sdj|�}y%tjj|�s3t|��nWntk
rSt|��nXtjj|�r�|r�tdj|���n|d%kr|j	d�s�|j	d�r�d}q]|j	d�s�|j	d�r�d}q]|j	d	�s�|j	d
�r]t
rd}qtd��q]n?|d
kr3d}n*|dkrHd}n|dkr]d}n|r�|d.kr�tdj|���ntjj|�}tjj|�s�|s�tdj|���q�n|r�t
d�}n|}|t|�dkr|n
t|�d}	ddd||	g}
tj�}td|
dt�}|ddkr�dj|�}|dr�|dj|d�7}nt|��n|r�|dkr�ytj|d�}
Wq,tk
r�}td j||���q,Xn6|dkrtj�}n|dkr,tj�}nzCy�t
d!|d"���}|dkrjt
d!|d�}
nd%}xi|d#kr�|jd$�}|rs|d/kr�|j|�}|r�|
j|�q�q�|
j|�qsqsW|d0kr
|j�}|r
|
j|�q
n|
j�Wd%QXWnMtk
rm}ytj|�Wntk
rTnXtd&j|���nXWd%ytj|�Wntk
r�nX|
j�Xnitj�|d'6}||d(<tj |�j!|d)<t"|d)�|d*<|j#d+t�rtd,|�|d-<n|S(1s&

    Saves an image and to a file on the minion. Equivalent to running the
    ``docker save`` Docker CLI command, but unlike ``docker save`` this will
    also work on named images instead of just images IDs.

    name
        Name or ID of image. Specify a specific tag by using the ``repo:tag``
        notation.

    path
        Absolute path on the Minion where the image will be exported

    overwrite : False
        Unless this option is set to ``True``, then if the destination file
        exists an error will be raised.

    makedirs : False
        If ``True``, then if the parent directory of the file specified by the
        ``path`` argument does not exist, Salt will attempt to create it.

    compression : None
        Can be set to any of the following:

        - ``gzip`` or ``gz`` for gzip compression
        - ``bzip2`` or ``bz2`` for bzip2 compression
        - ``xz`` or ``lzma`` for XZ compression (requires `xz-utils`_, as well
          as the ``lzma`` module from Python 3.3, available in Python 2 and
          Python 3.0-3.2 as `backports.lzma`_)

        This parameter can be omitted and Salt will attempt to determine the
        compression type by examining the filename passed in the ``path``
        parameter.

        .. note::
            Since the Docker API does not support ``docker save``, compression
            will be a bit slower with this function than with
            :py:func:`docker.export <salt.modules.dockermod.export>` since the
            image(s) will first be saved and then the compression done
            afterwards.

        .. _`xz-utils`: http://tukaani.org/xz/
        .. _`backports.lzma`: https://pypi.python.org/pypi/backports.lzma

    push : False
        If ``True``, the container will be pushed to the master using
        :py:func:`cp.push <salt.modules.cp.push>`.

        .. note::

            This requires :conf_master:`file_recv` to be set to ``True`` on the
            Master.


    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``Path`` - Path of the file that was saved
    - ``Push`` - Reports whether or not the file was successfully pushed to the
      Master

      *(Only present if push=True)*
    - ``Size`` - Size of the file, in bytes
    - ``Size_Human`` - Size of the file, in human-readable units
    - ``Time_Elapsed`` - Time in seconds taken to perform the save


    CLI Examples:

    .. code-block:: bash

        salt myminion docker.save centos:7 /tmp/cent7.tar
        salt myminion docker.save 0123456789ab cdef01234567 /tmp/saved.tar
    sPath '{0}' is not absolutes{0} already existss.tar.gzs.tgzR*s.tar.bz2s.tbz2R+s.tar.xzs.txzR,sdXZ compression unavailable. Install the backports.lzma module and xz-utils to enable XZ compression.R-R.R/sInvalid compression type '{0}'sTParent dir '{0}' of destination path does not exist. Use makedirs=True to create it.s
files.mkstempR�R�Rtsaves-oscmd.run_allRAReisFailed to save image(s) to {0}Rns: {0}R0s#Unable to open {0} for writing: {1}sfiles.fopentrbR�iNs%Error occurred during image save: {0}R�R�R�R2R�scp.pushR3(sgzipsbzip2sxz(sbzip2sxz(sbzip2sxz($R&RQR�RRR;R�RR RqR4R5RRsR R�RPRR*R6RR.R7R/R8R9R:R;R<RRLR=R>R?R�R#(R�R�R"RR@R^R�RAt
saved_patht
image_to_saveRvR�R�RBRgRCtuncompressedRDR�Rh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR|�s�P
						,



c	C@s�|dk	r&tddd�|}nt|tj�sJtj|�}nt|tj�sntj|�}nt|�d}td|d|d|d|�}t�|S(	s?
    .. versionchanged:: 2018.3.0
        The repository and tag must now be passed separately using the
        ``repository`` and ``tag`` arguments, rather than together in the (now
        deprecated) ``image`` argument.

    Tag an image into a repository and return ``True``. If the tag was
    unsuccessful, an error will be raised.

    name
        ID of image

    repository
        Repository name for the image to be built

        .. versionadded:: 2018.3.0

    tag : latest
        Tag name for the image to be built

        .. versionadded:: 2018.3.0

    image
        .. deprecated:: 2018.3.0
            Use both ``repository`` and ``tag`` instead

    force : False
        Force apply tag

    CLI Example:

    .. code-block:: bash

        salt myminion docker.tag 0123456789ab myrepo/mycontainer mytag
    sversions.warn_untilR�sXThe 'image' argument to docker.tag has been deprecated, please use 'repository' instead.R�RRVR�N(	R RsR�RRR�R R�R�(R�RVRR�R�RYR}R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRqs"$		cC@s�|dk	rtd|�}n|dk	r>td|�}ntdd|d|�}x`t|�D]R\}}yt|d�d}Wntk
r�qcqcX|rc|||d<qcqcW|S(s/
    .. versionchanged:: 2017.7.0
        The ``names`` and ``ids`` can be passed as a comma-separated list now,
        as well as a Python list.
    .. versionchanged:: 2018.3.0
        The ``Containers`` key for each network is no longer always empty.

    List existing networks

    names
        Filter by name

    ids
        Filter by id

    CLI Example:

    .. code-block:: bash

        salt myminion docker.networks names=network-web
        salt myminion docker.networks ids=1f9d2454d0872b68dd9e8744c6e7a4c66b86f10abaccc21e14f7f014f729b2bc
    sargs.split_inputRR�tidsR�R0N(R RsR�R�RKR(R�R�R�R�tnetinfoRa((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�s
c
K@s�tdtjjjjd|d|d|td|��}d|kr�i}xTgddgtd	�d	D]}||krk|^qkD]}|j|�||<q�W|jd
d
�}	|	s�|r�td|	|�|d<q�ntd||�}
t	�|
S(s�$
    .. versionchanged:: 2018.3.0
        Support added for network configuration options other than ``driver``
        and ``driver_opts``, as well as IPAM configuration.

    Create a new network

    .. note::
        This function supports all arguments for network and IPAM pool
        configuration which are available for the release of docker-py
        installed on the minion. For that reason, the arguments described below
        in the :ref:`NETWORK CONFIGURATION ARGUMENTS
        <salt-modules-dockermod-create-network-netconf>` and :ref:`IP ADDRESS
        MANAGEMENT (IPAM) <salt-modules-dockermod-create-network-ipam>`
        sections may not accurately reflect what is available on the minion.
        The :py:func:`docker.get_client_args
        <salt.modules.dockermod.get_client_args>` function can be used to check
        the available arguments for the installed version of docker-py (they
        are found in the ``network_config`` and ``ipam_config`` sections of the
        return data), but Salt will not prevent a user from attempting to use
        an argument which is unsupported in the release of Docker which is
        installed. In those cases, network creation be attempted but will fail.

    name
        Network name

    skip_translate
        This function translates Salt CLI or SLS input into the format which
        docker-py expects. However, in the event that Salt's translation logic
        fails (due to potential changes in the Docker Remote API, or to bugs in
        the translation code), this argument can be used to exert granular
        control over which arguments are translated and which are not.

        Pass this argument as a comma-separated list (or Python list) of
        arguments, and translation for each passed argument name will be
        skipped. Alternatively, pass ``True`` and *all* translation will be
        skipped.

        Skipping tranlsation allows for arguments to be formatted directly in
        the format which docker-py expects. This allows for API changes and
        other issues to be more easily worked around. See the following links
        for more information:

        - `docker-py Low-level API`_
        - `Docker Engine API`_

        .. versionadded:: 2018.3.0

    ignore_collisions : False
        Since many of docker-py's arguments differ in name from their CLI
        counterparts (with which most Docker users are more familiar), Salt
        detects usage of these and aliases them to the docker-py version of
        that argument. However, if both the alias and the docker-py version of
        the same argument (e.g. ``options`` and ``driver_opts``) are used, an error
        will be raised. Set this argument to ``True`` to suppress these errors
        and keep the docker-py version of the argument.

        .. versionadded:: 2018.3.0

    validate_ip_addrs : True
        For parameters which accept IP addresses as input, IP address
        validation will be performed. To disable, set this to ``False``

        .. note::
            When validating subnets, whether or not the IP portion of the
            subnet is a valid subnet boundary will not be checked. The IP will
            portion will be validated, and the subnet size will be checked to
            confirm it is a valid number (1-32 for IPv4, 1-128 for IPv6).

        .. versionadded:: 2018.3.0

    .. _salt-modules-dockermod-create-network-netconf:

    **NETWORK CONFIGURATION ARGUMENTS**

    driver
        Network driver

        Example: ``driver=macvlan``

    driver_opts (or *driver_opt*, or *options*)
        Options for the network driver. Either a dictionary of option names and
        values or a Python list of strings in the format ``varname=value``.

        Examples:

        - ``driver_opts='macvlan_mode=bridge,parent=eth0'``
        - ``driver_opts="['macvlan_mode=bridge', 'parent=eth0']"``
        - ``driver_opts="{'macvlan_mode': 'bridge', 'parent': 'eth0'}"``

    check_duplicate : True
        If ``True``, checks for networks with duplicate names. Since networks
        are primarily keyed based on a random ID and not on the name, and
        network name is strictly a user-friendly alias to the network which is
        uniquely identified using ID, there is no guaranteed way to check for
        duplicates. This option providess a best effort, checking for any
        networks which have the same name, but it is not guaranteed to catch
        all name collisions.

        Example: ``check_duplicate=False``

    internal : False
        If ``True``, restricts external access to the network

        Example: ``internal=True``

    labels
        Add metadata to the network. Labels can be set both with and without
        values:

        Examples (*with* values):

        - ``labels="label1=value1,label2=value2"``
        - ``labels="['label1=value1', 'label2=value2']"``
        - ``labels="{'label1': 'value1', 'label2': 'value2'}"``

        Examples (*without* values):

        - ``labels=label1,label2``
        - ``labels="['label1', 'label2']"``

    enable_ipv6 (or *ipv6*) : False
        Enable IPv6 on the network

        Example: ``enable_ipv6=True``

        .. note::
            While it should go without saying, this argument must be set to
            ``True`` to :ref:`configure an IPv6 subnet
            <salt-states-docker-network-present-ipam>`. Also, if this option is
            turned on without an IPv6 subnet explicitly configured, you will
            get an error unless you have set up a fixed IPv6 subnet. Consult
            the `Docker IPv6 docs`_ for information on how to do this.

            .. _`Docker IPv6 docs`: https://docs.docker.com/v17.09/engine/userguide/networking/default_network/ipv6/

    attachable : False
        If ``True``, and the network is in the global scope, non-service
        containers on worker nodes will be able to connect to the network.

        Example: ``attachable=True``

        .. note::
            While support for this option was added in API version 1.24, its
            value was not added to the inpsect results until API version 1.26.
            The version of Docker which is available for CentOS 7 runs API
            version 1.24, meaning that while Salt can pass this argument to the
            API, it has no way of knowing the value of this config option in an
            existing Docker network.

    scope
        Specify the network's scope (``local``, ``global`` or ``swarm``)

        Example: ``scope=local``

    ingress : False
        If ``True``, create an ingress network which provides the routing-mesh in
        swarm mode

        Example: ``ingress=True``

    .. _salt-modules-dockermod-create-network-ipam:

    **IP ADDRESS MANAGEMENT (IPAM)**

    This function supports networks with either IPv4, or both IPv4 and IPv6. If
    configuring IPv4, then you can pass the IPAM arguments as shown below, as
    individual arguments on the Salt CLI. However, if configuring IPv4 and
    IPv6, the arguments must be passed as a list of dictionaries, in the
    ``ipam_pools`` argument. See the **CLI Examples** below. `These docs`_ also
    have more information on these arguments.

    .. _`These docs`: http://docker-py.readthedocs.io/en/stable/api.html#docker.types.IPAMPool

    *IPAM ARGUMENTS*

    ipam_driver
        IPAM driver to use, if different from the default one

        Example: ``ipam_driver=foo``

    ipam_opts
        Options for the IPAM driver. Either a dictionary of option names
        and values or a Python list of strings in the format
        ``varname=value``.

        Examples:

        - ``ipam_opts='foo=bar,baz=qux'``
        - ``ipam_opts="['foo=bar', 'baz=quz']"``
        - ``ipam_opts="{'foo': 'bar', 'baz': 'qux'}"``

    *IPAM POOL ARGUMENTS*

    subnet
        Subnet in CIDR format that represents a network segment

        Example: ``subnet=192.168.50.0/25``

    iprange (or *ip_range*)
        Allocate container IP from a sub-range within the subnet

        Subnet in CIDR format that represents a network segment

        Example: ``iprange=192.168.50.64/26``

    gateway
        IPv4 gateway for the master subnet

        Example: ``gateway=192.168.50.1``

    aux_addresses (or *aux_address*)
        A dictionary of mapping container names to IP addresses which should be
        allocated for them should they connect to the network. Either a
        dictionary of option names and values or a Python list of strings in
        the format ``host=ipaddr``.

        Examples:

        - ``aux_addresses='foo.bar.tld=192.168.50.10,hello.world.tld=192.168.50.11'``
        - ``aux_addresses="['foo.bar.tld=192.168.50.10', 'hello.world.tld=192.168.50.11']"``
        - ``aux_addresses="{'foo.bar.tld': '192.168.50.10', 'hello.world.tld': '192.168.50.11'}"``


    CLI Examples:

    .. code-block:: bash

        salt myminion docker.create_network web_network driver=bridge
        # IPv4
        salt myminion docker.create_network macvlan_network driver=macvlan driver_opts="{'parent':'eth0'}" gateway=172.20.0.1 subnet=172.20.0.0/24
        # IPv4 and IPv6
        salt myminion docker.create_network mynet ipam_pools='[{"subnet": "10.0.0.0/24", "gateway": "10.0.0.1"}, {"subnet": "fe3f:2180:26:1::60/123", "gateway": "fe3f:2180:26:1::61"}]'
    sdocker.translate_inputRRRsargs.clean_kwargstipamtipam_drivert	ipam_optstipam_configt
ipam_poolssdocker.create_ipam_configtcreate_network((
RsRSRTRRtnetworkRRtR�R�(R�RRRRrR^tipam_kwargsR�R`R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s*�cC@std|�}t�tS(s
    Remove a network

    network_id
        Network name or ID

    CLI Examples:

    .. code-block:: bash

        salt myminion docker.remove_network mynet
        salt myminion docker.remove_network 1f9d2454d0872b68dd9e8744c6e7a4c66b86f10abaccc21e14f7f014f729b2bc
    tremove_network(R�R�RX(t
network_idR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��scC@std|�}t�|S(s�
    Inspect Network

    network_id
        ID of network

    CLI Example:

    .. code-block:: bash

        salt myminion docker.inspect_network 1f9d2454d0872b68dd9e8744c6e7a4c66b86f10abaccc21e14f7f014f729b2bc
    RK(R�R�(R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRK�s
cK@s�td|�}|jdd	�}|d	k	rHtddd�|}ntjd|||�td|||�}tjd||�t�tS(
sv
    .. versionadded:: 2015.8.3
    .. versionchanged:: 2017.7.0
        Support for ``ipv4_address`` argument added
    .. versionchanged:: 2018.3.0
        All arguments are now passed through to
        `connect_container_to_network()`_, allowing for any new arguments added
        to this function to be supported automagically.

    Connect container to network. See the `connect_container_to_network()`_
    docs for information on supported arguments.

    container
        Container name or ID

    net_id
        Network name or ID

    CLI Examples:

    .. code-block:: bash

        salt myminion docker.connect_container_to_network web-1 mynet
        salt myminion docker.connect_container_to_network web-1 mynet ipv4_address=10.20.0.10
        salt myminion docker.connect_container_to_network web-1 1f9d2454d0872b68dd9e8744c6e7a4c66b86f10abaccc21e14f7f014f729b2bc
    sargs.clean_kwargsR�sversions.warn_untilR�s[The 'network_id' argument to docker.build has been deprecated, please use 'net_id' instead.sNConnecting container '%s' to network '%s' with the following configuration: %stconnect_container_to_networks5Successfully connected container '%s' to network '%s'N(RsRtR R[R\R�R�RX(Rtnet_idR^R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�s&	
	
cC@sCtjd||�td||�}tjd||�t�tS(s�
    .. versionadded:: 2015.8.3

    Disconnect container from network

    container
        Container name or ID

    network_id
        Network name or ID

    CLI Examples:

    .. code-block:: bash

        salt myminion docker.disconnect_container_from_network web-1 mynet
        salt myminion docker.disconnect_container_from_network web-1 1f9d2454d0872b68dd9e8744c6e7a4c66b86f10abaccc21e14f7f014f729b2bc
    s.Disconnecting container '%s' from network '%s't!disconnect_container_from_networks:Successfully disconnected container '%s' from network '%s'(R[R\R�R�RX(RR�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�As
	
cC@s�t|�}g}g}xj|D]b}yt||�|j|�Wqtk
r�}|j�}d|kr�|j|�q�qXqW|r�tddi|d6|d6��n|S(sG
    .. versionadded:: 2018.3.0

    Runs :py:func:`docker.disconnect_container_from_network
    <salt.modules.dockermod.disconnect_container_from_network>` on all
    containers connected to the specified network, and returns the names of all
    containers that were disconnected.

    network_id
        Network name or ID

    CLI Examples:

    .. code-block:: bash

        salt myminion docker.disconnect_all_containers_from_network mynet
        salt myminion docker.disconnect_all_containers_from_network 1f9d2454d0872b68dd9e8744c6e7a4c66b86f10abaccc21e14f7f014f729b2bc
    t404s+One or more containers failed to be removedR�tremovedR�(RdR�R/RR�(R�RRRhtfailedtcnameRgR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt&disconnect_all_containers_from_networkcs 

cC@stdd|�}|S(s�
    List existing volumes

    .. versionadded:: 2015.8.4

    filters
      There is one available filter: dangling=true

    CLI Example:

    .. code-block:: bash

        salt myminion docker.volumes filters="{'dangling': True}"
    RGR�(R�(R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRG�scC@s&td|d|d|�}t�|S(s-
    Create a new volume

    .. versionadded:: 2015.8.4

    name
        name of volume

    driver
        Driver of the volume

    driver_opts
        Options for the driver volume

    CLI Example:

    .. code-block:: bash

        salt myminion docker.create_volume my_volume driver=local
    t
create_volumeR�tdriver_opts(R�R�(R�R�R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s	cC@std|�}t�tS(s�
    Remove a volume

    .. versionadded:: 2015.8.4

    name
        Name of volume

    CLI Example:

    .. code-block:: bash

        salt myminion docker.remove_volume my_volume
    t
remove_volume(R�R�RX(R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��scC@std|�}t�|S(s�
    Inspect Volume

    .. versionadded:: 2015.8.4

    name
      Name of volume

    CLI Example:

    .. code-block:: bash

        salt myminion docker.inspect_volume my_volume
    R�(R�R�(R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��scC@st|dd�S(s5
    Kill all processes in a running container instead of performing a graceful
    shutdown

    name
        Container name or ID

    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``status`` - A dictionary showing the prior state of the container as
      well as the new state
    - ``result`` - A boolean noting whether or not the action was successful
    - ``comment`` - Only present if the container cannot be killed


    CLI Example:

    .. code-block:: bash

        salt myminion docker.kill mycontainer
    tkillRo(R�(R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��scC@sXt|�}|dkrHitd6i|d6|d6d6dj|�d6St|dd	�S(
s�
    Pauses a container

    name
        Container name or ID


    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``status`` - A dictionary showing the prior state of the container as
      well as the new state
    - ``result`` - A boolean noting whether or not the action was successful
    - ``comment`` - Only present if the container cannot be paused


    CLI Example:

    .. code-block:: bash

        salt myminion docker.pause mycontainer
    RoR�R�R�R�s(Container '{0}' is stopped, cannot pauseR�tpauseRl(R�RR&R�(R�t
orig_state((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�s
tfreezei
cC@s3t|ddd|�}|dr/t|d<n|S(s�
    Restarts a container

    name
        Container name or ID

    timeout : 10
        Timeout in seconds after which the container will be killed (if it has
        not yet gracefully shut down)


    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``status`` - A dictionary showing the prior state of the container as
      well as the new state
    - ``result`` - A boolean noting whether or not the action was successful
    - ``restarted`` - If restart was successful, this key will be present and
      will be set to ``True``.


    CLI Examples:

    .. code-block:: bash

        salt myminion docker.restart mycontainer
        salt myminion docker.restart mycontainer timeout=20
    R�RnR<R�t	restarted(R�RX(R�R<Rh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�(s

cC@std|d|�tS(s%
    Send a signal to a container. Signals can be either strings or numbers, and
    are defined in the **Standard Signals** section of the ``signal(7)``
    manpage. Run ``man 7 signal`` on a Linux host to browse this manpage.

    name
        Container name or ID

    signal
        Signal to send to container

    **RETURN DATA**

    If the signal was successfully sent, ``True`` will be returned. Otherwise,
    an error will be raised.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.signal mycontainer SIGHUP
    R�R
(R�RX(R�R
((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRLscC@sXt|�}|dkrHitd6i|d6|d6d6dj|�d6St|dd	�S(
s�
    Start a container

    name
        Container name or ID

    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``status`` - A dictionary showing the prior state of the container as
      well as the new state
    - ``result`` - A boolean noting whether or not the action was successful
    - ``comment`` - Only present if the container cannot be started


    CLI Example:

    .. code-block:: bash

        salt myminion docker.start mycontainer
    RlR�R�R�R�s'Container '{0}' is paused, cannot startR�RRn(R�RR&R�(R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRhs
cK@s
|dkrJyt|�dd}WqJtk
rFtjjj}qJXnt|�}|dkr�|jdt	�r�t
|dd�}|dt	kr�dj|�|d<|Sq�it	d6i|d	6|d
6d6dj|�d6Snt
|d
dd|�}||dd	<|S(s�
    Stops a running container

    name
        Container name or ID

    unpause : False
        If ``True`` and the container is paused, it will be unpaused before
        attempting to stop the container.

    timeout
        Timeout in seconds after which the container will be killed (if it has
        not yet gracefully shut down)

        .. versionchanged:: 2017.7.0
            If this argument is not passed, then the container's configuration
            will be checked. If the container was created using the
            ``stop_timeout`` argument, then the configured timeout will be
            used, otherwise the timeout will be 10 seconds.

    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``status`` - A dictionary showing the prior state of the container as
      well as the new state
    - ``result`` - A boolean noting whether or not the action was successful
    - ``comment`` - Only present if the container can not be stopped


    CLI Examples:

    .. code-block:: bash

        salt myminion docker.stop mycontainer
        salt myminion docker.stop mycontainer unpause=True
        salt myminion docker.stop mycontainer timeout=20
    RtStopTimeoutRltunpauseRnR�s!Failed to unpause container '{0}'R�R�R�R�sKContainer '{0}' is paused, run with unpause=True to unpause before stoppingRERoR<N(R RR�RSRTRtSHUTDOWN_TIMEOUTR�R#RR�R&(R�R<R^R�tunpause_resultRh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRE�s&(

cC@sXt|�}|dkrHitd6i|d6|d6d6dj|�d6St|dd	�S(
s�
    Unpauses a container

    name
        Container name or ID


    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``status`` - A dictionary showing the prior state of the container as
      well as the new state
    - ``result`` - A boolean noting whether or not the action was successful
    - ``comment`` - Only present if the container can not be unpaused


    CLI Example:

    .. code-block:: bash

        salt myminion docker.pause mycontainer
    RoR�R�R�R�s*Container '{0}' is stopped, cannot unpauseR�R�Rn(R�RR&R�(R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s
tunfreezec	C@s"yt|�}Wn)tk
r;i|d6dj|�d6SX|dk}td|�}t�yt|�}Wntk
r�d}nX|r�|}n|dkr�t}nt}i|d6i|d6|d6d6|d	6}|r�d
j|�|d<n|r|dr|d	dk|d<n|S(
s�
    Wait for the container to exit gracefully, and return its exit code

    .. note::

        This function will block until the container is stopped.

    name
        Container name or ID

    ignore_already_stopped
        Boolean flag that prevents execution to fail, if a container
        is already stopped.

    fail_on_exit_status
        Boolean flag to report execution as failure if ``exit_status``
        is different than 0.

    **RETURN DATA**

    A dictionary will be returned, containing the following keys:

    - ``status`` - A dictionary showing the prior state of the container as
      well as the new state
    - ``result`` - A boolean noting whether or not the action was successful
    - ``exit_status`` - Exit status for the container
    - ``comment`` - Only present if the container is already stopped


    CLI Example:

    .. code-block:: bash

        salt myminion docker.wait mycontainer
    R�sContainer '{0}' absentR�RotwaitR�R�R�texit_statussContainer '{0}' already stoppediN(R�RR&R�R�R RXR(	R�tignore_already_stoppedtfail_on_exit_statusR�talready_stoppedR�R�tsuccessR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s2$



		

c	K@s�|dkr.t||||f�r.t}ntd|�}xGt|�D]9}t||t�sKtjj	j
||�||<qKqKWi}|s�|r�tdd|�|d<n|s�|r�tdd|�|d<n|s�|r�tdd|�|d<n|s	|rbytd	d|�|d
<Wqbtk
r^tdtdtd
d��t�|d
<qbXn|r�tdd|�|d<n|S(s!
    .. versionadded:: 2019.2.0

    Prune Docker's various subsystems

    .. note::
        This requires docker-py version 2.1.0 or later.

    containers : False
        If ``True``, prunes stopped containers (documentation__)

        .. __: https://docs.docker.com/engine/reference/commandline/container_prune/#filtering

    images : False
        If ``True``, prunes unused images (documentation__)

        .. __: https://docs.docker.com/engine/reference/commandline/image_prune/#filtering

    networks : False
        If ``False``, prunes unreferenced networks (documentation__)

        .. __: https://docs.docker.com/engine/reference/commandline/network_prune/#filtering)

    build : False
        If ``True``, clears the builder cache

        .. note::
            Only supported in Docker 17.07.x and newer. Additionally, filters
            do not apply to this argument.

    volumes : False
        If ``True``, prunes unreferenced volumes (documentation__)

        .. __: https://docs.docker.com/engine/reference/commandline/volume_prune/

    system
        If ``True``, prunes containers, images, networks, and builder cache.
        Assumed to be ``True`` if none of ``containers``, ``images``,
        ``networks``, or ``build`` are set to ``True``.

        .. note::
            ``volumes=True`` must still be used to prune volumes

    filters
        - ``dangling=True`` (images only) - remove only dangling images

        - ``until=<timestamp>`` - only remove objects created before given
          timestamp. Not applicable to volumes. See the documentation links
          above for examples of valid time expressions.

        - ``label`` - only remove objects matching the label expression. Valid
          expressions include ``labelname`` or ``labelname=value``.

    CLI Examples:

    .. code-block:: bash

        salt myminion docker.prune system=True
        salt myminion docker.prune system=True until=12h
        salt myminion docker.prune images=True dangling=True
        salt myminion docker.prune images=True label=foo,bar=baz
    sargs.clean_kwargstprune_containersR�Ratprune_imagesR�tprune_networksRtprune_buildRKt_resultt_postt_urls/build/prunet
prune_volumesRGN(
R R6RXRsR�R�RRSRTRwtsplit_inputR�R(	RaRR�RKRGtsystemR�tfnameRh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRe7s4@%	$
R\c
C@s}|dkrt�}ntd||dtd|d|d|d|d|d|d	|d
|	�	}
|d
krq|
S|
|SdS(s/
    Common logic for docker.run functions
    scontainer_resource.runR'R(R�tstdinRARlR�tuse_vttkeep_envRN(Nsall(R R�RPR%(R�RvR(R�R�RARlR�R�R�Rh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_run�s"	tbasecC@s�d�}tddddddtjj|�d�}
|r�td	||
||�}|s�||
�id
d6dd6d
d6d
d6td6SnZtd||�}|s�||
�id
d6dd6d
d6d
d6td6Stj||
�|dkrt	�}nt
||
|
d|�t|d|
�t||rM|
dt
j|�n|
d|d|d|d|d|	d|
d|�}||
�t|d|
�|S(s5
    Common logic to run a script on a container
    cS@sDytj|�Wn,ttfk
r?}tjd||�nXdS(s>
        Remove the tempfile allocated for the script
        s-cmd.script: Unable to clean tempfile '%s': %sN(RQRLtIOErrorRR[R�(R�Rg((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_cleanup_tempfile�ss
files.mkstemptdirs/tmptprefixRStsuffixiscp.get_templateiR�ReR�RoRntcache_errors
cp.cache_fileR(s
chmod 700 t R�RARlR�R�R�srm N(RsRQR�tsplitextRPRXtshutiltcopyfileR R�R)truntrun_allRR�(R�R tsaltenvRwttemplateR(R�RARlR�R�R�R�R�tfn_Rh((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_script�sN	



#	
c		C@s=t||d|ddd|d|d|d|d|d	|�S(
s5
    Run :py:func:`cmd.retcode <salt.modules.cmdmod.retcode>` within a container

    name
        Container name or ID in which to run the command

    cmd
        Command to run

    exec_driver : None
        If not passed, the execution driver will be detected as described
        :ref:`above <docker-execution-driver>`.

    stdin : None
        Standard input to be used for the command

    output_loglevel : debug
        Level at which to log the output from the command. Set to ``quiet`` to
        suppress logging.

    use_vt : False
        Use SaltStack's utils.vt to stream output to console.

    keep_env : None
        If not passed, only a sane default PATH environment variable will be
        set. If ``True``, all environment variables from the container's host
        will be kept. Otherwise, a comma-separated list (or Python list) of
        environment variable names can be passed, and those environment
        variables will be kept.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.retcode mycontainer 'ls -l /etc'
    R(R�ReR�RARlR�R�R�(R�(	R�RvR(R�RARlR�R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRes-c		C@s=t||d|dd	d|d|d|d|d|d|�S(
s)
    Run :py:func:`cmd.run <salt.modules.cmdmod.run>` within a container

    name
        Container name or ID in which to run the command

    cmd
        Command to run

    exec_driver : None
        If not passed, the execution driver will be detected as described
        :ref:`above <docker-execution-driver>`.

    stdin : None
        Standard input to be used for the command

    output_loglevel : debug
        Level at which to log the output from the command. Set to ``quiet`` to
        suppress logging.

    use_vt : False
        Use SaltStack's utils.vt to stream output to console.

    keep_env : None
        If not passed, only a sane default PATH environment variable will be
        set. If ``True``, all environment variables from the container's host
        will be kept. Otherwise, a comma-separated list (or Python list) of
        environment variable names can be passed, and those environment
        variables will be kept.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.run mycontainer 'ls -l /etc'
    R(R�R�RARlR�R�R�N(R�R (	R�RvR(R�RARlR�R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�@s-c		C@s=t||d|ddd|d|d|d|d|d	|�S(
s�
    Run :py:func:`cmd.run_all <salt.modules.cmdmod.run_all>` within a container

    .. note::

        While the command is run within the container, it is initiated from the
        host. Therefore, the PID in the return dict is from the host, not from
        the container.

    name
        Container name or ID in which to run the command

    cmd
        Command to run

    exec_driver : None
        If not passed, the execution driver will be detected as described
        :ref:`above <docker-execution-driver>`.

    stdin : None
        Standard input to be used for the command

    output_loglevel : debug
        Level at which to log the output from the command. Set to ``quiet`` to
        suppress logging.

    use_vt : False
        Use SaltStack's utils.vt to stream output to console.

    keep_env : None
        If not passed, only a sane default PATH environment variable will be
        set. If ``True``, all environment variables from the container's host
        will be kept. Otherwise, a comma-separated list (or Python list) of
        environment variable names can be passed, and those environment
        variables will be kept.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.run_all mycontainer 'ls -l /etc'
    R(R�RR�RARlR�R�R�(R�(	R�RvR(R�RARlR�R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�ys3c		C@s=t||d|ddd|d|d|d|d|d	|�S(
sB
    Run :py:func:`cmd.run_stderr <salt.modules.cmdmod.run_stderr>` within a
    container

    name
        Container name or ID in which to run the command

    cmd
        Command to run

    exec_driver : None
        If not passed, the execution driver will be detected as described
        :ref:`above <docker-execution-driver>`.

    stdin : None
        Standard input to be used for the command

    output_loglevel : debug
        Level at which to log the output from the command. Set to ``quiet`` to
        suppress logging.

    use_vt : False
        Use SaltStack's utils.vt to stream output to console.

    keep_env : None
        If not passed, only a sane default PATH environment variable will be
        set. If ``True``, all environment variables from the container's host
        will be kept. Otherwise, a comma-separated list (or Python list) of
        environment variable names can be passed, and those environment
        variables will be kept.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.run_stderr mycontainer 'ls -l /etc'
    R(R�RnR�RARlR�R�R�(R�(	R�RvR(R�RARlR�R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt
run_stderr�s.c		C@s=t||d|ddd|d|d|d|d|d	|�S(
sB
    Run :py:func:`cmd.run_stdout <salt.modules.cmdmod.run_stdout>` within a
    container

    name
        Container name or ID in which to run the command

    cmd
        Command to run

    exec_driver : None
        If not passed, the execution driver will be detected as described
        :ref:`above <docker-execution-driver>`.

    stdin : None
        Standard input to be used for the command

    output_loglevel : debug
        Level at which to log the output from the command. Set to ``quiet`` to
        suppress logging.

    use_vt : False
        Use SaltStack's utils.vt to stream output to console.

    keep_env : None
        If not passed, only a sane default PATH environment variable will be
        set. If ``True``, all environment variables from the container's host
        will be kept. Otherwise, a comma-separated list (or Python list) of
        environment variable names can be passed, and those environment
        variables will be kept.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.run_stdout mycontainer 'ls -l /etc'
    R(R�RoR�RARlR�R�R�(R�(	R�RvR(R�RARlR�R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s.cC@sIt||d|d|d|d|d|d|d|d|	d	|
d
|�
S(s�
    Run :py:func:`cmd.script <salt.modules.cmdmod.script>` within a container

    .. note::

        While the command is run within the container, it is initiated from the
        host. Therefore, the PID in the return dict is from the host, not from
        the container.

    name
        Container name or ID

    source
        Path to the script. Can be a local path on the Minion or a remote file
        from the Salt fileserver.

    args
        A string containing additional command-line options to pass to the
        script.

    template : None
        Templating engine to use on the script before running.

    exec_driver : None
        If not passed, the execution driver will be detected as described
        :ref:`above <docker-execution-driver>`.

    stdin : None
        Standard input to be used for the script

    output_loglevel : debug
        Level at which to log the output from the script. Set to ``quiet`` to
        suppress logging.

    use_vt : False
        Use SaltStack's utils.vt to stream output to console.

    keep_env : None
        If not passed, only a sane default PATH environment variable will be
        set. If ``True``, all environment variables from the container's host
        will be kept. Otherwise, a comma-separated list (or Python list) of
        environment variable names can be passed, and those environment
        variables will be kept.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.script mycontainer salt://docker_script.py
        salt myminion docker.script mycontainer salt://scripts/runme.sh 'arg1 arg2 "arg 3"'
        salt myminion docker.script mycontainer salt://scripts/runme.sh stdin='one\ntwo\nthree\nfour\nfive\n' output_loglevel=quiet
    R�RwR�R(R�RARlR�R�R�(R�(R�R R�RwR�R(R�RARlR�R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytscript,s@cC@sMt||d|d|d|d|d|d|d|d|	d	|
d
|�
dS(sA
    Run :py:func:`cmd.script_retcode <salt.modules.cmdmod.script_retcode>`
    within a container

    name
        Container name or ID

    source
        Path to the script. Can be a local path on the Minion or a remote file
        from the Salt fileserver.

    args
        A string containing additional command-line options to pass to the
        script.

    template : None
        Templating engine to use on the script before running.

    exec_driver : None
        If not passed, the execution driver will be detected as described
        :ref:`above <docker-execution-driver>`.

    stdin : None
        Standard input to be used for the script

    output_loglevel : debug
        Level at which to log the output from the script. Set to ``quiet`` to
        suppress logging.

    use_vt : False
        Use SaltStack's utils.vt to stream output to console.

    keep_env : None
        If not passed, only a sane default PATH environment variable will be
        set. If ``True``, all environment variables from the container's host
        will be kept. Otherwise, a comma-separated list (or Python list) of
        environment variable names can be passed, and those environment
        variables will be kept.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.script_retcode mycontainer salt://docker_script.py
        salt myminion docker.script_retcode mycontainer salt://scripts/runme.sh 'arg1 arg2 "arg 3"'
        salt myminion docker.script_retcode mycontainer salt://scripts/runme.sh stdin='one\ntwo\nthree\nfour\nfive\n' output_loglevel=quiet
    R�RwR�R(R�RARlR�R�R�Re(R�(R�R R�RwR�R(R�RARlR�R�R�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytscript_retcodezs;cC@s)dtkr%tjjt�td<ndS(s9
    Create a file client and add it to the context.
    s
cp.fileclientN(RuRSt
fileclienttget_file_clientRH(((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_mk_fileclient�scC@s)tjjddjtj�jd ��S(Ns/tmpssalt.docker.{0}i(RQR�R'R&tuuidtuuid4thex(((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_generate_tmp_path�s	R�cC@s]t||�}tjjjj||�}t�tjjjjtd||||�}|S(sa
    Prepares a self contained tarball that has the state
    to be applied in the container
    s
cp.fileclient(	t_compile_stateRStclienttsshR�tlowstate_file_refsR�tprep_trans_tarRu(R�tsls_optstmodstpillartextra_filerefstchunkstrefst	trans_tar((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt_prepare_trans_tar�scC@s�t|�}|s|j�S|ji||d6�\}}|jj|�\}}||7}||jj|�7}|r~|S|jj|�\}}||7}|jj|�}|r�|S|jj|�S(sB
    Generates the chunks of lowdata from the list of modules
    R�(	Rtcompile_low_chunkstrender_highstateR�treconcile_extendtverify_hightrequisite_int
apply_excludetcompile_high_data(R�R�tst_t	high_dataR�t
ext_errorst
req_in_errors((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR��s
 

cO@s�t�}dd|g}t|tj|��}|ddkrVitd6|dd6S|d(krqtd��ntd	td
dt	dd
d�dt	ddd��}t
||tjj
|tjj|���}dddj|tjj|��g}t|tj|��}|ddkr=itd6|dd6Sz�djtjd�tjj
|d�dddtjj
|d�dtjj
|d�ddddd |gt|�g|j�D]-\}	}
|	jd!�s�d"j|	|
�^q�}t|tjtt|���}|ddkr9t|d��nyitd#|d$�}|jd%|�}
t|
t�r�d|
kr�|
dtd<q�n|
jd&|�SWn tk
r�itd6d'd6SXWd(d)d*|g}t|tj|��Xd(S(+s�
    Executes a Salt function inside a running container

    .. versionadded:: 2016.11.0

    The container does not need to have Salt installed, but Python is required.

    name
        Container name or ID

    function
        Salt execution module function

    CLI Example:

    .. code-block:: bash

        salt myminion docker.call test.ping
        salt myminion test.arg arg1 arg2 key1=val1
        salt myminion dockerng.call compassionate_mirzakhani test.arg arg1 arg2 key1=val1

    tmkdirs-pReiR�RnR�sMissing function parameters
thin.gen_thintcachedirt
extra_modss
config.optiontthin_extra_modsR�tso_modstthin_so_modstpythons-cs>import tarfile; tarfile.open("{0}/{1}").extractall(path="{0}")s	python{0}s	salt-calls
--metadatas--locals
--log-fileR[s
--cachedirRWs--outRUs-lRms--t__s{0}={1}sjson.find_jsonRotlocalRs$Can't parse container command outputNRs-rf(R�R�t
subprocesstlist2cmdlineRR RRsRHRPR)RQR�R'RR&tsysR:R�R�R�RR(R#R�RIRuRM(R�tfunctionRwR^tthin_dest_pathtmkdirp_thin_argvRht	thin_patht	untar_cmdR`tvaluet	salt_argvR�R�trm_thin_argv((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pytcall�sF	
-�!


cK@s#|rt|||�St||�S(s�
    .. versionadded:: 2019.2.0

    Apply states! This function will call highstate or state.sls based on the
    arguments passed in, ``apply`` is intended to be the main gateway for
    all state executions.

    CLI Example:

    .. code-block:: bash

        salt 'docker' docker.apply web01
        salt 'docker' docker.apply web01 test
        salt 'docker' docker.apply web01 test,pkgs
    (RR(R�R�R^((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRTscK@s}|r.g|jd�D]}|j�^qng}|jdd�}d|kr_d|d<ntdt|�}t|d�}tjj	t|tdd|d	|d	�j
�}|r�t|t�r�|j
|�nt||d
|d|d|jdd��}t�}	d
d|	g}
t|tj|
��}|ddkr[itd6|dd6Sd}zltd|d�}t||tjj|	d�dt�dt�t|dtjj|	d�|d�}Wddd|	g}
t|tj|
��ytj|�Wn,ttfk
r4}tjd||�nXXt|t�sRdt d<n'td|�sod t d<n
dt d<|S(!s�
    Apply the states defined by the specified SLS modules to the running
    container

    .. versionadded:: 2016.11.0

    The container does not need to have Salt installed, but Python is required.

    name
        Container name or ID

    mods : None
        A string containing comma-separated list of SLS with defined states to
        apply to the container.

    saltenv : base
        Specify the environment from which to retrieve the SLS indicated by the
        `mods` parameter.

    pillarenv
        Specify a Pillar environment to be used when applying states. This
        can also be set in the minion config file using the
        :conf_minion:`pillarenv` option. When neither the
        :conf_minion:`pillarenv` minion config option nor this CLI argument is
        used, all Pillar environments will be merged together.

        .. versionadded:: 2018.3.0

    pillar
        Custom Pillar values, passed as a dictionary of key-value pairs

        .. note::
            Values passed this way will override Pillar values set via
            ``pillar_roots`` or an external Pillar source.

        .. versionadded:: 2018.3.0

    CLI Example:

    .. code-block:: bash

        salt myminion docker.sls compassionate_mirzakhani mods=rails,web

    RR�R�R�sstate.get_sls_optssgrains.itemsR�tpillar_overridet	pillarenvR�R�R�R�s-pReiR�RnR�shashutils.get_hashtsha256ssalt_state.tgzR(R"s	state.pkgNRs-rfs3docker.sls: Unable to remove state tarball '%s': %sisstate.check_resulti(!R�R�RtR RsRHR�RSR�t
get_pillartcompile_pillarR�RIRR�R#R�R�R�R�RR)RQR�R'R�RXRLR�RR[R�Ru(R�R�R^R�R�R�tgrainsR�R�ttrans_dest_pathtmkdirp_trans_argvRhttrans_tar_sha256t
rm_trans_argvRg((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyRish-4
	
		



cK@st|dd|�S(s�
    Apply a highstate to the running container

    .. versionadded:: 2019.2.0

    The container does not need to have Salt installed, but Python is required.

    name
        Container name or ID

    saltenv : base
        Specify the environment from which to retrieve the SLS indicated by the
        `mods` parameter.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.highstate compassionate_mirzakhani

    R�R�(R(R�R�R^((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyR�ssopensuse/pythonc
K@s6|jdd�}|dk	r8tddd�|}ntdtj|��}x-dD]%}y||=WqXtk
r|qXXqXWtd|dddtd	t|�}	|	d}
zkt|
�t	|
||�}	|r�td
|	�r�t
|	��n|tkrt|
|d|�}	nWdt
|
�t|
�X|	S(sX
    .. versionchanged:: 2018.3.0
        The repository and tag must now be passed separately using the
        ``repository`` and ``tag`` arguments, rather than together in the (now
        deprecated) ``image`` argument.

    Build a Docker image using the specified SLS modules on top of base image

    .. versionadded:: 2016.11.0

    The base image does not need to have Salt installed, but Python is required.

    repository
        Repository name for the image to be built

        .. versionadded:: 2018.3.0

    tag : latest
        Tag name for the image to be built

        .. versionadded:: 2018.3.0

    name
        .. deprecated:: 2018.3.0
            Use both ``repository`` and ``tag`` instead

    base : opensuse/python
        Name or ID of the base image

    mods
        A string containing comma-separated list of SLS with defined states to
        apply to the base image.

    saltenv : base
        Specify the environment from which to retrieve the SLS indicated by the
        `mods` parameter.

    pillarenv
        Specify a Pillar environment to be used when applying states. This
        can also be set in the minion config file using the
        :conf_minion:`pillarenv` option. When neither the
        :conf_minion:`pillarenv` minion config option nor this CLI argument is
        used, all Pillar environments will be merged together.

        .. versionadded:: 2018.3.0

    pillar
        Custom Pillar values, passed as a dictionary of key-value pairs

        .. note::
            Values passed this way will override Pillar values set via
            ``pillar_roots`` or an external Pillar source.

        .. versionadded:: 2018.3.0

    dryrun: False
        when set to True the container will not be committed at the end of
        the build. The dryrun succeed also when the state contains errors.

    **RETURN DATA**

    A dictionary with the ID of the new container. In case of a dryrun,
    the state result is returned and the container gets removed.

    CLI Example:

    .. code-block:: bash

        salt myminion docker.sls_build imgname base=mybase mods=rails,web

    R�sversions.warn_untilR�s]The 'name' argument to docker.sls_build has been deprecated, please use 'repository' instead.sargs.clean_kwargsR�RvtinteractivetttyR�ssleep infinityR�sstate.check_resultRN(simagesnamescmdsinteractivesttysextra_filerefs(RtR RsR�R�R�R�RXRRRRR_RER(RVRR�R�tdryrunR^R�RR`RhR�((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt	sls_build�s8M	

	


(�t__doc__t
__future__Rt
__docformat__R.R�R�R{R*RUtloggingRQR�R�R�R�R�R�R�R�tsalt.exceptionsRRtsalt.extRtsalt.ext.six.movesRt%salt.utils.docker.translate.containerRSt#salt.utils.docker.translate.networktsalt.utils.functoolstsalt.utils.jsontsalt.utils.pathtsalt.pillartsalt.fileclientt
salt.stateRtsalt.client.ssh.stateRRXRtImportErrorRtPY2tbackports.lzmaR/R4R�R�RRTR�twhichR�t	getLoggerR8R[t__func_alias__R$R!R�tobjectROR%t__virtual_aliases__t__proxyenabled__t
__outputter__R+tJSONDecoderR,RRiRqR}R�R�R�R�R�R�R R�R�R�R�R�R�R�R�R�R�RRRR+talias_functionR,RSR_RdRjR�R�R�R�R�R�R@RR R�R�R�R�R�R�R�R
R�R�R�R"RtCLIENT_TIMEOUTR�RR&RR)R1RRIRKR_RhRRjRqR�R�RdR|RRR�R�RKR�R�R�RGR�R�R�R�R�R�R�RRRER�R�R�ReR�R�ReR�R�R�R�R�R�R�R�R�R�R�RRRR(((s:/usr/lib/python2.7/site-packages/salt/modules/dockermod.pyt<module>�s`


	






		
	&	
4									&					0			<		27[		�I,	c	(	*	!YE		;		"			L	T	OL	F	%		����p6�I	�W;l�	a\	N�=+�			5	"	*		"$"C"D	d>33944E>			Xu

Zerion Mini Shell 1.0