Your IP : 3.14.245.172


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/clcommon/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/clcommon/__pycache__/clproc.cpython-311.pyc

�

\�Dg2��h�ddlZdZdZGd�de��ZGd�de��ZGd�d	��ZdS)
�Nz	/proc/lvel��c��eZdZdS)�ProcLveErrorN��__name__�
__module__�__qualname__���o/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/clproc.pyrr��������Dr
rc��eZdZdS)�	NoSuchLvpNrr	r
rrrrr
rc��eZdZefd�Zd�Zd�Zd�Zd�Zd�Z	dd�Z
d	�Zdd
�Zdd�Z
dd
�Zd�Zdd�Zd�Zd�Zd�Zd�ZdS)�ProcLvec�>�d|_d|_||_d|_dS)N�lvp�list)�_lvpr�proc_lve�_version)�selfrs  r�__init__zProcLve.__init__s"����	���	� ��
���
�
�
r
c�V�tj�|j|j��S)z/
        Return path to /proc/lve/list
        )�os�path�joinrr�rs r�
proc_lve_listzProcLve.proc_lve_lists���w�|�|�D�M�4�9�5�5�5r
c�(�|j�|jSt|���d���5}|�d��}ddd��n#1swxYwYt	|�dd��d��|_|jS)z5
        Return /proc/lve filesystem version
        N�utf-8��encoding��:�r)r�openr�read�int�rsplit)r�f�lines   r�versionzProcLve.version%s����=�$��=� �
�$�$�$�&�&��
9�
9�
9�	�Q��6�6�!�9�9�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��D�K�K��Q�/�/��2�3�3��
��}�s�A�A�Ac�L�tj�|jd��S)N�map�rrrrrs r�proc_lve_mapzProcLve.proc_lve_map0s���w�|�|�D�M�5�1�1�1r
c�L�tj�|jd��S)z4
        Return path to /proc/lve/resellers
        �	resellersr/rs r�proc_lve_resellerszProcLve.proc_lve_resellers3s���w�|�|�D�M�;�7�7�7r
c�d�tj�|�����S)z3
        Check present /proc/lve/resellers
        )rr�existsr3rs r�resellers_supportedzProcLve.resellers_supported9s$���w�~�~�d�5�5�7�7�8�8�8r
rc���|dkr|���Stj�|���|jt
|��z|j��S)z,
        Generate path to list file
        r)rrrrr3r�strr�r�lvp_ids  r�
get_list_pathzProcLve.get_list_path?sT���Q�;�;��%�%�'�'�'��7�<�<�� 7� 7� 9� 9�4�9�s�6�{�{�;R�TX�T]�^�^�^r
c��t|���d�d��d��S)Nr�,���)r(�split)rr+s  r�_extract_idzProcLve._extract_idHs/���4�:�:�<�<��?�(�(��-�-�b�1�2�2�2r
c#��K�|�|���}	t|d���5}|������}ddd��n#1swxYwYn1#t$r$}|jdkrt
d|����|��d}~wwxYw|�d��dd�}|D]8}|�|��|�	tj��fV��9dS)N�r:r r!�zNo such lvp id �
r%)r;r&r'�strip�IOError�errnorr?r@�rstripr�linesep)rr:r�list_�lines�er+s       r�_lineszProcLve._linesKsO�����!�!��!�0�0��	��d�W�-�-�-�
-���
�
���*�*�,�,��
-�
-�
-�
-�
-�
-�
-�
-�
-�
-�
-����
-�
-�
-�
-����	�	�	��w�!�|�|�� :�&� :� :�;�;��B������		����
���D�!�!�!�"�"�%���	B�	B�D��"�"�4�(�(�$�+�+�b�j�*A�*A�A�A�A�A�A�	B�	Bs:�A*�'A�A*�A"�"A*�%A"�&A*�*
B�4B�BTc#�fK�|�|���D]\}}|tkr|r�|V��dS)NrB�rM�LIMIT_LVP_ID)rr:�without_limits�lve_idr+s     rrKz
ProcLve.linesYsO���� �K�K�v�K�6�6�	�	�L�F�D���%�%�.�%���J�J�J�J�	�	r
c#�bK�|�|���D]\}}|tdfvr�|V��dS)NrBrrO)rr:rR�_s    r�lve_id_listzProcLve.lve_id_list_sO�������F��3�3�	�	�I�F�A��,��*�*�*���L�L�L�L�	�	r
c#��K�tj|�����D]G}|�|j��r+t|t
|j��d���V��HdS)z=
        Obtain from /proc/lve/resellers lvp id list
        N)r�listdirr3�
startswithrr(�len)r�lvp_dirs  r�lvp_id_listzProcLve.lvp_id_listesu�����z�$�"9�"9�";�";�<�<�	4�	4�G��!�!�$�)�,�,�
4��'�#�d�i�.�.�/�/�2�3�3�3�3�3��	4�	4r
c�J�|�|���D]}||krdS�dS)NrBT)rU)r�id_r:rRs    r�check_inside_listzProcLve.check_inside_listmsA���&�&�f�&�5�5�	�	�F���}�}��t�t��	�	r
c�f�tj�|�|����S)z1
        Check present lve top container
        )rrr5r;r9s  r�	exist_lvpzProcLve.exist_lvprs&���w�~�~�d�0�0��8�8�9�9�9r
c��|���D]1}|�|��r|�||��r|cS�2dS)z1
        Find in which lve top container
        N)r[r`r^)rr]r:s   r�detect_inside_lvpzProcLve.detect_inside_lvpxs^���&�&�(�(�	�	�F��~�~�f�%�%�
�$�*@�*@��f�*M�*M�
��
�
�
��	�	r
c��i}t|���d���5}|������}ddd��n#1swxYwY|�d��dd�}|D]J}|������\}}t|��|t|��<�K|S)z7
        Obtain map from /proc/lve/map as dict
        r r!NrDr%)r&r0r'rEr?r()r�map_dict�map_rKr+�
lve_id_str�
lvp_id_strs       rr.zProcLve.map�s�����
�$�#�#�%�%��
8�
8�
8�	(�D��I�I�K�K�%�%�'�'�E�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(����D�!�!�!�"�"�%���	8�	8�D�%)�Z�Z�\�\�%7�%7�%9�%9�"�J�
�(+�J���H�S��_�_�%�%��s�'A�A� Ac����fd�t|��������D��S)Nc�&��g|]
\}}|�k�|��Sr	r	)�.0�lve_id_�lvp_id_r:s   �r�
<listcomp>z+ProcLve.map_lve_id_list.<locals>.<listcomp>�s)���^�^�^�,�G�W�G�W]�L]�L]��L]�L]�L]r
)rr.�itemsr9s `r�map_lve_id_listzProcLve.map_lve_id_list�s9���^�^�^�^��T�X�X�Z�Z�5E�5E�5G�5G�0H�0H�^�^�^�^r
N)r)rT)rrr�PROC_LVErrr,r0r3r6r;r@rMrKrUr[r^r`rbr.ror	r
rrrsA������ (�����6�6�6�	�	�	�2�2�2�8�8�8�9�9�9�_�_�_�_�3�3�3�B�B�B�B���������4�4�4�����
:�:�:�������_�_�_�_�_r
r)rrprP�	Exceptionrrrr	r
r�<module>rrs���
�	�	�	�����	�	�	�	�	�9�	�	�	�	�	�	�	�	��	�	�	�w_�w_�w_�w_�w_�w_�w_�w_�w_�w_r

?>