ok
Direktori : /opt/imunify360/venv/lib/python3.11/site-packages/im360/plugins/__pycache__/ |
Current File : //opt/imunify360/venv/lib/python3.11/site-packages/im360/plugins/__pycache__/cagefs.cpython-311.pyc |
� �cg� � �� � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl mZ ddlm Z mZ ddlmZmZ ddlmZ d Zd Z ej e� � Z G d� de � � ZdS ) a Goal: Invoke /usr/sbin/cagefsctl --update-etc /usr/sbin/cagefsctl --force-update-etc asynchronously. As far production scale `cagefsctl --force-update-etc` tends last for too long, e.g. - # time cagefsctl --force-update-etc Updating users ... Updating user user523 ... Updating user user804 ... ... Updating user user269 ... Updating user user116 ... Updating user user121 ... Updating user user117 ... real 2m44.454s user 0m26.233s sys 0m19.972s � N)�Optional)� inactivity)�MessageType)�MessageSink�expect)� load_state� save_state)�timefunz/usr/sbin/cagefsctlz--wait-lockc � � e Zd Zd� Zd� Z eej � � d� � � Zd� Z e ej �� � de e fd�� � Zed� � � Zd S ) �CageFSc � � K � || _ t j � � | _ t d� � � dd� � | _ | j � | � � � � � | _ d S )Nr �last_force_update_tsr ) �_loop�asyncio�Queue�_queuer �get�_last_force_update_ts�create_task� _consumer�_consumer_task)�self�loops �I/opt/imunify360/venv/lib/python3.11/site-packages/im360/plugins/cagefs.py�create_sinkzCageFS.create_sink, si � � � ��� ��m�o�o���%/��%9�%9�%=�%=�"�A�& � & ��"� #�j�4�4�T�^�^�5E�5E�F�F����� c � � K � | j � � � | j � d {V �� | j � � � r2t � d| j � � � � � t dd| j i� � d S )Nz%d item(s) were not consumedr r )r �cancelr �qsize�logger�warningr r )r s r �shutdownzCageFS.shutdown4 s� � � � ���"�"�$�$�$��!�!�!�!�!�!�!�!��;����� P��N�N�9�4�;�;L�;L�;N�;N�O�O�O���-�t�/I�J� � � � � r c � � K � |d }t |dd � � }|�|� | j � � r| j � |� � d S d S )N�conf�username)�getattr�modified_sincer r � put_nowait)r �message�configr% s r �put_to_queuezCageFS.put_to_queue? si � � � ������6�:�t�4�4�� ��6�#8�#8��&�$ � $ �� �K�"�"�8�,�,�,�,�,� �r c � �N K � | j � � � � d{V ��}t j � t � � s�F|h} |� | j � � � � � �-# t j $ r Y nw xY wt j � d� � 5 |D ]}| � |� � � d{V �� � ddd� � n# 1 swxY w Y n<# t j $ r Y dS t $ r t � d� � Y ��w xY w��#)z :raise never: TN�cagefszSomething went wrong)r r �os�path�exists�_CAGEFSCTL_TOOL�add� get_nowaitr � QueueEmptyr �track�task� _commitconfig�CancelledError� Exceptionr � exception)r �commitconfig_username�uniqr% s r r zCageFS._consumerM s� � � � � � �.2�k�o�o�.?�.?�(?�(?�(?�(?�(?�(?�%� �w�~�~�o�6�6� �� .�.���;������!7�!7�!9�!9�:�:�:�;���)� � � ��D����� �%�*�*�8�4�4� ;� ;�$(� ;� ;��"�0�0��:�:�:�:�:�:�:�:�:�:�;�;� ;� ;� ;� ;� ;� ;� ;� ;� ;� ;���� ;� ;� ;� ;��� �)� � � ����� � � �� � �!7�8�8�8� �� ����/ s` �AC) � C) � .A; �;B � C) �B � "C) �/!C�C) �C!�!C) �$C!�%C) �)D"�;#D"�!D")�logr% c � �J K � |rt t d|g}nt t dg} t j |t j t j t j dd��� d{V ��}| � |t j |j � � }| � |t j |j � � }t j ||� � � d{V �� |� � � � d{V ��\ }}|� � � � d{V ��}|�t � d� � dS |r t � d||||� � dS t � d||� � |�t'