File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/__pycache__/etcd_db.cpython-310.pyc
Back
o ;je � @ s� d Z ddlZzddlZejjjsejjjrdZndZW n e y& dZY nw e� e�ZddiZ dZdd � Zdd d�Zddd�Zdd d�Zdd� ZdS )aM etcd Database Module :maintainer: SaltStack :maturity: New :depends: python-etcd or etcd3-py :platform: all .. versionadded:: 2015.5.0 This module allows access to the etcd database using an ``sdb://`` URI. This package is located at ``https://pypi.python.org/pypi/python-etcd``. Like all sdb modules, the etcd module requires a configuration profile to be configured in either the minion or master configuration file. This profile requires very little. In the example: .. code-block:: yaml myetcd: driver: etcd etcd.host: 127.0.0.1 etcd.port: 2379 The ``driver`` refers to the etcd module, ``etcd.host`` refers to the host that is hosting the etcd database and ``etcd.port`` refers to the port on that host. In order to choose whether to use etcd API v2 or v3, you can put the following configuration option in the same place as your etcd configuration. This option defaults to true, meaning you will use v2 unless you specify otherwise. .. code-block:: yaml etcd.require_v2: True .. code-block:: yaml password: sdb://myetcd/mypassword � NTF�set_�setZetcdc C s t rtS dS )z6 Only load the module if keyring is installed F)�HAS_LIBS�__virtualname__� r r �D/opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/etcd_db.py�__virtual__= s r c C s t |�}|�| |� t| ||�S )z2 Set a key/value pair in the etcd service )� _get_connr �get)�key�value�service�profile�clientr r r r F s c C s t |�}|�| �S )�+ Get a value from the etcd service )r r �r r r r r r r r O s r c C s. t |�}z|�| � W dS ty Y dS w )r TF)r �delete� Exceptionr r r r r W s �r c C s t jj�| �S )z Get a connection )�salt�utils� etcd_utilZget_conn)r r r r r c s r )NN)�__doc__�loggingZsalt.utils.etcd_utilr r r ZHAS_ETCD_V2ZHAS_ETCD_V3r �ImportError� getLogger�__name__�logZ__func_alias__r r r r r r r r r r �<module> s&