File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/redismod.cpython-310.pyc
o
;jjB � @ s� d Z ddlZzddlZdZW n ey dZY nw dZdd� Zdcdd �Zddd
d�Z dcdd
�Z
dcdd�Zdedd�Zdcdd�Z
dcdd�Zdd� Zdcdd�Zdcdd�Zdcdd�Zdcdd �Zdcd!d"�Zdcd#d$�Zd%d&� Zdcd'd(�Zdcd)d*�Zdcd+d,�Zdfd.d/�Z dgd1d2�Zdcd3d4�Zd5d6� Zd7d8� Zdcd9d:�Zdcd;d<�Z dcd=d>�Z! dhd?d@�Z"dcdAdB�Z#dedCdD�Z$dcdEdF�Z%dcdGdH�Z&dcdIdJ�Z'dcdKdL�Z(dcdMdN�Z)dcdOdP�Z*dcdQdR�Z+dcdSdT�Z, didUdV�Z-dcdWdX�Z.dcdYdZ�Z/dcd[d\�Z0dcd]d^�Z1ddd_d`�Z2dddadb�Z3dS )jaN
Module to provide redis functionality to Salt
.. versionadded:: 2014.7.0
:configuration: This module requires the redis python module and uses the
following defaults which may be overridden in the minion configuration:
.. code-block:: yaml
redis.host: 'salt'
redis.port: 6379
redis.db: 0
redis.password: None
� NTF�redisc C s t rtS dS )zC
Only load this module if redis python module is installed
)FzUThe redis execution module failed to load: the redis python library is not available.)� HAS_REDIS�__virtualname__� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/redismod.py�__virtual__ s r c C sX | st d d�} |st d d�}|du rt d d�}|s"t d d�}tj| |||dd�S ) �1
Returns an instance of the redis client
�
config.optionz
redis.hostz
redis.portNzredis.dbzredis.passwordT)�decode_responses�Z__salt__r ZStrictRedis��host�port�db�passwordr r r �_connect+ s r c C sR | du rt d dd�} |du rt d dd�}|du r t d d�}tj| ||dd �S )
r Nr zredis_sentinel.hostZ localhostzredis_sentinel.portig zredis_sentinel.passwordT)r r
r �r
r r r r r � _sconnect>