File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/engines/__pycache__/redis_sentinel.cpython-310.pyc
Back
o ;j � @ sj d Z ddlZddlZzddlZW n ey dZY nw e�e�ZdZ dd� Z G dd� d�Zd dd �ZdS )a An engine that reads messages from the redis sentinel pubsub and sends reactor events based on the channels they are subscribed to. .. versionadded:: 2016.3.0 :configuration: Example configuration .. code-block:: yaml engines: - redis_sentinel: hosts: matching: 'board*' port: 26379 interface: eth2 channels: - '+switch-master' - '+odown' - '-odown' :depends: redis � N�redisc C s t d urtS dS )N)Fz$redis python module is not installed)r �__virtualname__� r r �O/opt/saltstack/salt/lib/python3.10/site-packages/salt/engines/redis_sentinel.py�__virtual__) s ���r c s. e Zd Zd� fdd� Zdd� Zdd� Z� ZS ) �ListenerNc s� |d u rd}|d u rd}|d u rdg}|d u rd}t � �� || _tj|||dd�| _| j�� | _| j�|� tjj � ttd �j| _ d S )NZ localhostig �*�salt/engine/redis_sentinelT)�host�port�passwordZdecode_responsesZsock_dir)�super�__init__�tagr ZStrictRedis�pubsubZ psubscribe�salt�utils�eventZget_master_eventZ__opts__Z fire_event�fire_master)�selfr r �channelsr r �� __class__r r r 2 s( ���zListener.__init__c C s� d|d i}t |d t�r|d |d<