관리-도구
편집 파일: license_lib.cpython-311.pyc
� |�Cg� � �0 � d dl Z d dlZ G d� d� � ZdS )� Nc �. � e Zd Zd� Zd� Zd� Zd� Zdd�ZdS )�CloudlinuxLicenseLibc �0 � d| _ d| _ d| _ d S )Nz/usr/bin/cldetectz/usr/sbin/clnreg_ksz/usr/sbin/clncheck)�_CLDETECT_UTILITY�_CLNREG_KS_UTILITY�_CLNCHECK_UTILITY��selfs �L/opt/cloudlinux/venv/lib64/python3.11/site-packages/cllicense/license_lib.py�__init__zCloudlinuxLicenseLib.__init__ s � �!4���"7���!5����� c �� � t j | j ddgt j t j �� � 5 }|� � � |j dk cddd� � S # 1 swxY w Y dS )zr Checks Cloudlinux license :return: True - license valid False - invalid z--check-licensez-q��stdout�stderrr N)� subprocess�Popenr �PIPE�communicate� returncode)r �procs r �get_license_statusz'CloudlinuxLicenseLib.get_license_status s� � � � � � #�%6��=��?��?� � � � (� ��������?�a�'� (� (� (� (� (� (� (� (� (� (� (� (���� (� (� (� (� (� (s �A � A$�'A$c �J � t j � | j � � S �N)�os�path�isfiler r s r �is_edition_migration_availablez3CloudlinuxLicenseLib.is_edition_migration_available$ s � ��w�~�~�d�4�5�5�5r c �� � t j | j d|gt j t j �� � 5 }|� � � ddd� � dS # 1 swxY w Y dS )zp Register and update Cloudlinux license by key :param key: License key :return: z--update-new-keyr N)r r r r r )r �keyr s r �"register_and_update_license_by_keyz7CloudlinuxLicenseLib.register_and_update_license_by_key( s� � � � � � #�%7��=��?��?� � � � � ������� � � � � � � � � � � � ���� � � � � � s �A�A�ANc � � |�|dk r�| j dg}| � � � r|� d� � t j |t j t j �� � 5 }|� � � ddd� � n# 1 swxY w Y |�|dk rat j | j dgt j t j �� � 5 }|� � � ddd� � dS # 1 swxY w Y dS dS )a Register and update Cloudlinux license by IP :param stage: Registraton stage. None - all stages. Normal mode 'clnreg_ks' - only clnreg_ks. Only for tests 'cldetect' - only cldetect. Only for tests :return: N� clnreg_ksz--forcez--migrate-silentlyr �cldetectz--update-license)r r �appendr r r r r )r �stage� clnreg_cmdr s r �!register_and_update_license_by_ipz6CloudlinuxLicenseLib.register_and_update_license_by_ip6 s� � � �=�E�[�0�0��1�9�=�J��2�2�4�4� 8��!�!�"6�7�7�7��!��!��!��� � � #� �� � �"�"�"� #� #� #� #� #� #� #� #� #� #� #���� #� #� #� #� �=�E�Z�/�/��!��'�);�<�!��!��� � � #� �� � �"�"�"� #� #� #� #� #� #� #� #� #� #� #� #���� #� #� #� #� #� #� 0�/s$ �&B�B�B�C.�.C2�5C2r )�__name__� __module__�__qualname__r r r r! r( � r r r r sd � � � � � �6� 6� 6� (� (� (�6� 6� 6�� � �#� #� #� #� #� #r r )r r r r, r r �<module>r- sX �� � � � � � � � �B#� B#� B#� B#� B#� B#� B#� B#� B#� B#r