%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZdZidd6ZyddlZe	Z
Wnek
rdeZ
nXd�Z
dd�Zdd	�Zdd
�Zedd�Zedd�Zd
�ZdS(u
Manage etcd Keys
================

.. versionadded:: 2015.8.0

:depends:  - python-etcd

This state module supports setting and removing keys from etcd.

Configuration
-------------

To work with an etcd server you must configure an etcd profile. The etcd config
can be set in either the Salt Minion configuration file or in pillar:

.. code-block:: yaml

    my_etd_config:
      etcd.host: 127.0.0.1
      etcd.port: 4001

It is technically possible to configure etcd without using a profile, but this
is not considered to be a best practice, especially when multiple etcd servers
or clusters are available.

.. code-block:: yaml

    etcd.host: 127.0.0.1
    etcd.port: 4001

.. note::

    The etcd configuration can also be set in the Salt Master config file,
    but in order to use any etcd configurations defined in the Salt Master
    config, the :conf_master:`pillar_opts` must be set to ``True``.

    Be aware that setting ``pillar_opts`` to ``True`` has security implications
    as this makes all master configuration settings available in all minion's
    pillars.

Etcd profile configuration can be overridden using following arguments: ``host``,
``port``, ``username``, ``password``, ``ca``, ``client_key`` and ``client_cert``.

.. code-block:: yaml

    my-value:
      etcd.set:
        - name: /path/to/key
        - value: value
        - host: 127.0.0.1
        - port: 2379
        - username: user
        - password: pass

Available Functions
-------------------

- ``set``

  This will set a value to a key in etcd. Changes will be returned if the key
  has been created or the value of the key has been updated. This
  means you can watch these states for changes.

  .. code-block:: yaml

      /foo/bar/baz:
        etcd.set:
          - value: foo
          - profile: my_etcd_config

- ``wait_set``

  Performs the same functionality as ``set`` but only if a watch requisite is ``True``.

  .. code-block:: yaml

      /some/file.txt:
        file.managed:
          - source: salt://file.txt

      /foo/bar/baz:
        etcd.wait_set:
          - value: foo
          - profile: my_etcd_config
          - watch:
            - file: /some/file.txt

- ``rm``

  This will delete a key from etcd. If the key exists then changes will be
  returned and thus you can watch for changes on the state, if the key does
  not exist then no changes will occur.

  .. code-block:: yaml

      /foo/bar/baz:
        etcd.rm:
          - profile: my_etcd_config

- ``wait_rm``

  Performs the same functionality as ``rm`` but only if a watch requisite is ``True``.

  .. code-block:: yaml

      /some/file.txt:
        file.managed:
          - source: salt://file.txt

      /foo/bar/baz:
        etcd.wait_rm:
          - profile: my_etcd_config
          - watch:
            - file: /some/file.txt
i(tabsolute_importtprint_functiontunicode_literalsuetcdusetuset_NcC@str
tStS(u1
    Only return if python-etcd is installed
    (tHAS_ETCDt__virtualname__tFalse(((s8/usr/lib/python2.7/site-packages/salt/states/etcd_mod.pyt__virtual__�scK@s�t}i|d6dd6td6id6}td|d||�}|sPt}ntd||d||�}|r�||kr�|r�d	|d<n
d
|d<i||6|d<n|S(u�
    Set a key in etcd

    name
        The etcd key name, for example: ``/foo/bar/baz``.
    value
        The value the key should contain.

    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.

        .. code-block:: yaml

            my_etd_config:
              etcd.host: 127.0.0.1
              etcd.port: 4001

    unameuKey contains correct valueucommenturesultuchangesuetcd.gettprofileuetcd.setuNew key createduKey value updated(RtTruet__salt__(tnametvalueRtkwargstcreatedtrtntcurrenttresult((s8/usr/lib/python2.7/site-packages/salt/states/etcd_mod.pytset_�s"
	

cK@s i|d6id6td6dd6S(u�
    Set a key in etcd only if the watch statement calls it. This function is
    also aliased as ``wait_set``.

    name
        The etcd key name, for example: ``/foo/bar/baz``.
    value
        The value the key should contain.
    profile
        The etcd profile to use that has been configured on the Salt Master,
        this is optional and defaults to ``None``.

        .. code-block:: yaml

            my_etd_config:
              etcd.host: 127.0.0.1
              etcd.port: 4001

    unameuchangesuresultuucomment(R(R
RRR((s8/usr/lib/python2.7/site-packages/salt/states/etcd_mod.pytwait_set�s
cK@s�t}i|d6dd6td6id6}td|d|dt|�}|sVt}ntd	|d
d
td||�}|r�||kr�|r�d|d<id|6|d<q�n|S(uu
    Create a directory in etcd.

    name
        The etcd directory name, for example: ``/foo/bar/baz``.
    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.

        .. code-block:: yaml

            my_etd_config:
              etcd.host: 127.0.0.1
              etcd.port: 4001
    unameuDirectory existsucommenturesultuchangesuetcd.getRtrecurseuetcd.sett	directoryuNew directory createduCreatedN(RRR	tNone(R
RRR
RRR((s8/usr/lib/python2.7/site-packages/salt/states/etcd_mod.pyR�s 
	"
cK@s�i|d6td6id6}td|d||�sBd|d<|Std|d	|d||�rd
|d<id|6|d<n
d|d<|S(
u�
    Deletes a key from etcd

    name
        The etcd key name to remove, for example ``/foo/bar/baz``.

    recurse
        Optional, defaults to ``False``. If ``True`` performs a recursive delete.

    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.

        .. code-block:: yaml

            my_etd_config:
              etcd.host: 127.0.0.1
              etcd.port: 4001
    unameuresultuchangesuetcd.getRuKey does not existucommentuetcd.rmRuKey removeduDeleteduUnable to remove key(RR	(R
RRRR((s8/usr/lib/python2.7/site-packages/salt/states/etcd_mod.pytrm
s



cK@s i|d6id6td6dd6S(us
    Deletes a key from etcd only if the watch statement calls it.
    This function is also aliased as ``wait_rm``.

    name
        The etcd key name to remove, for example ``/foo/bar/baz``.
    recurse
        Optional, defaults to ``False``. If ``True`` performs a recursive
        delete, see: https://python-etcd.readthedocs.io/en/latest/#delete-a-key.
    profile
        Optional, defaults to ``None``. Sets the etcd profile to use which has
        been defined in the Salt Master config.

        .. code-block:: yaml

            my_etd_config:
              etcd.host: 127.0.0.1
              etcd.port: 4001
    unameuchangesuresultuucomment(R(R
RRR((s8/usr/lib/python2.7/site-packages/salt/states/etcd_mod.pytwait_rm4s
cK@s�|jd�d
kr7t||jd�|jd��S|jd�dkrbt||jd��Si|d6id	6d
j|�d6td6S(uz
    The etcd watcher, called to invoke the watch command.
    When called, execute a etcd function based on a watch call requisite.

    .. note::
        This state exists to support special handling of the ``watch``
        :ref:`requisite <requisites>`. It should not be called directly.

        Parameters for this function should be set by the state being triggered.
    usfunuwait_set_keyuwait_setuvalueuprofileuwait_rm_keyuwait_rmunameuchangesu_etcd.{0[sfun]} does not work with the watch requisite, please use etcd.wait_set or etcd.wait_rmucommenturesult(uwait_set_keyuwait_set(uwait_rm_keyuwait_rm(tgetRRtformatR(R
R((s8/usr/lib/python2.7/site-packages/salt/states/etcd_mod.pyt	mod_watchQs

(t__doc__t
__future__RRRRt__func_alias__tsalt.utils.etcd_utiltsaltRRtImportErrorRRRRRRRRR(((s8/usr/lib/python2.7/site-packages/salt/states/etcd_mod.pyt<module>vs 



	0**

Zerion Mini Shell 1.0