Edit File: plugins.cpython-311.opt-1.pyc
� �gh6 � �x � d dl Z d dlZd dlmZ d dlmZmZ ej e� � Z G d� dej � � ZdS )� N)�utils)�messages�pluginsc � � � e Zd ZdZdZ ej ej j � � d� � � Z � fd�Z� fd�Zd� Z d� Zd� Zd � Zd � Z� xZS )�IDSAwareMessageSinkz^A message sink that accepts messages taking into account the current IDS (strategy). Nc � � K � | j �|j | j k r�| � � � s� | � � � � d{V �� t � d| � � dS # t j $ r � t $ r2 t � d| � � t j � � Y dS w xY wdS | � � � r� | � � � � d{V �� t � d| � � dS # t t j f$ r2 t � d| � � t j � � Y dS w xY wdS )z7De/activate the plugin on strategy change if necessary.NzPlugin %r is activatedzFailed to activate %r plugin�Plugin %r is deactivated�Failed to deactivate %r plugin) �STRATEGY�strategy� is_active�activate�logger�info�asyncio�CancelledError� Exception� exceptionr �fail_agent_service� deactivate)�self�messages �L/opt/imunify360/venv/lib/python3.11/site-packages/im360/contracts/plugins.py�on_strategy_changez&IDSAwareMessageSink.on_strategy_change s� � � � � �=� �G�$4�� �$E�$E��>�>�#�#� @�@��-�-�/�/�)�)�)�)�)�)�)� �K�K� 8�$�?�?�?�?�?�� �-� � � �� � /� /� /��$�$�%C�T�J�J�J��,�.�.�.�.�.�.�/���� @� @� �^�^� � � >� >��o�o�'�'�'�'�'�'�'�'�'� ���6��=�=�=�=�=�� �w�5�6� +� +� +�� � �!A�4�H�H�H��(�*�*�*�*�*�*� +���� >� >s% �A&