File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/dockercompose.cpython-310.pyc
Back
o ;j� � @ s� d Z ddlZddlZddlZddlZddlmZ ddlZddl Zddl mZ ddlm Z zddlZddlmZ ddlmZ dZW n eyK d ZY nw z dd lmZ dZW n eya d ZY nw dZdZe�e�Zd Zd ZdZdd� Z dKdd�Z!dd� Z"dd� Z#dd� Z$dd� Z%dd� Z&dd� Z'dd � Z(d!d"� Z)d#d$� Z*d%d&� Z+d'd(� Z,d)d*� Z-d+d,� Z.dLd-d.�Z/dLd/d0�Z0dLd1d2�Z1dLd3d4�Z2dLd5d6�Z3dLd7d8�Z4dLd9d:�Z5dLd;d<�Z6dLd=d>�Z7d?d@� Z8dLdAdB�Z9dCdD� Z:dEdF� Z;dGdH� Z<dIdJ� Z=dS )MaQ Module to import docker-compose via saltstack .. versionadded:: 2016.3.0 :maintainer: Jean Praloran <jeanpralo@gmail.com> :maturity: new :depends: docker-compose>=1.5 :platform: all Introduction ------------ This module allows one to deal with docker-compose file in a directory. This is a first version only, the following commands are missing at the moment but will be built later on if the community is interested in this module: - run - logs - port - scale Installation Prerequisites -------------------------- This execution module requires at least version 1.4.0 of both docker-compose_ and Docker_. docker-compose can easily be installed using :py:func:`pip.install <salt.modules.pip.install>`: .. code-block:: bash salt myminion pip.install docker-compose>=1.5.0 .. _docker-compose: https://pypi.python.org/pypi/docker-compose .. _Docker: https://www.docker.com/ How to use this module? ----------------------- In order to use the module if you have no docker-compose file on the server you can issue the command create, it takes two arguments the path where the docker-compose.yml will be stored and the content of this latter: .. code-block:: text # salt-call -l debug dockercompose.create /tmp/toto ' database: image: mongo:3.0 command: mongod --smallfiles --quiet --logpath=/dev/null ' Then you can execute a list of method defined at the bottom with at least one argument (the path where the docker-compose.yml will be read) and an optional python list which corresponds to the services names: .. code-block:: bash # salt-call -l debug dockercompose.up /tmp/toto # salt-call -l debug dockercompose.restart /tmp/toto '[database]' # salt-call -l debug dockercompose.stop /tmp/toto # salt-call -l debug dockercompose.rm /tmp/toto Docker-compose method supported ------------------------------- - up - restart - stop - start - pause - unpause - kill - rm - ps - pull - build Functions --------- - docker-compose.yml management - :py:func:`dockercompose.create <salt.modules.dockercompose.create>` - :py:func:`dockercompose.get <salt.modules.dockercompose.get>` - Manage containers - :py:func:`dockercompose.restart <salt.modules.dockercompose.restart>` - :py:func:`dockercompose.stop <salt.modules.dockercompose.stop>` - :py:func:`dockercompose.pause <salt.modules.dockercompose.pause>` - :py:func:`dockercompose.unpause <salt.modules.dockercompose.unpause>` - :py:func:`dockercompose.start <salt.modules.dockercompose.start>` - :py:func:`dockercompose.kill <salt.modules.dockercompose.kill>` - :py:func:`dockercompose.rm <salt.modules.dockercompose.rm>` - :py:func:`dockercompose.up <salt.modules.dockercompose.up>` - Manage containers image: - :py:func:`dockercompose.pull <salt.modules.dockercompose.pull>` - :py:func:`dockercompose.build <salt.modules.dockercompose.build>` - Gather information about containers: - :py:func:`dockercompose.ps <salt.modules.dockercompose.ps>` - Manage service definitions: - :py:func:`dockercompose.service_create <salt.modules.dockercompose.ps>` - :py:func:`dockercompose.service_upsert <salt.modules.dockercompose.ps>` - :py:func:`dockercompose.service_remove <salt.modules.dockercompose.ps>` - :py:func:`dockercompose.service_set_tag <salt.modules.dockercompose.ps>` Detailed Function Documentation ------------------------------- � N)� attrgetter)�json)�yaml)�get_project)�ConvergenceStrategyTF)�OneOffFilter)� � r z([\d.]+)Z dockercompose)zdocker-compose.ymlzdocker-compose.yamlc C sH t r"t�tttj��} | r"tdd� | �d�� d�D ��}|t kr"tS dS )Nc s s � | ]}t |�V qd S �N)�int)�.0�x� r �N/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/dockercompose.py� <genexpr>� s � z__virtual__.<locals>.<genexpr>r �.)FzTThe dockercompose execution module not loaded: compose python library not available.)�HAS_DOCKERCOMPOSE�re�match� VERSION_RE�str�compose�__version__�tuple�group�split�MIN_DOCKERCOMPOSE�__virtualname__)r �versionr r r �__virtual__� s r c C s2 | |d�}|dur ||d<