????
| Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/clwizard/__pycache__/ |
| Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/clwizard/__pycache__/parser.cpython-311.pyc |
�
����x)� �p � d dl Z d dlZd dlZd dlmZ ej d� � ZdhZdhZh d�Z d� Z
d� Zd � ZdS )
� N)�get_supported_modulesz\A\d+(\.\d+){0,2}\Z�versions�default_version> �enable_selector�use_beta_for_da�enable_for_new_users�enable_for_existing_usersc �B � |t v r2t |t � � st j d| � d|� d�� � �d S |t
v r�t |t � � st j d| � d|� d�� � �|D ]N}t |t � � rt � |� � st j d| � d|� d|��� � ��Od S |t v rLt |t � � rt � |� � st j d| � d|� d|��� � �d S d S )N�'z' module option 'z' must be a booleanz' must be a listz' contains invalid version: z' has invalid version: )�
_BOOL_OPTIONS�
isinstance�bool�argparse�ArgumentTypeError�_VERSION_LIST_OPTIONS�list�str�_VERSION_RE�match�_VERSION_STRING_OPTIONS)�module_name�key�value�vers �py/clwizard/parser.py�_validate_option_valuer s� � �
�m����%��&�&� ��,�J�K�J�J�#�J�J�J�� �
� � �
�%� %� %��%��&�&� ��,�G�K�G�G�#�G�G�G�� �
� � � �C��c�3�'�'�
�{�/@�/@��/E�/E�
��0�9�� 9� 9�c� 9� 9�14�9� 9�� � �
� � �
�'� '� '��%��%�%� �[�->�->�u�-E�-E� ��,�2�K� 2� 2�#� 2� 2�(-�2� 2�� �
�
(� '� � � c
� � t j | � � }n.# t t f$ r}t j d� � |�d }~ww xY wt
� � }|� � � D �]e\ }}||vr9t j d|� dt |� � � � � � �� � �dt |� � � � � v r�t |d � � � � � � || � � � � � s?t j d|� dt |d � � � � � � �� � �|d � � � D ]\ }}t |||� � ���*|r9t j d|� dt |� � � � � � �� � ���g|S )NzInvalid JSON data passedr z9' module is not supported at the moment, available keys: �optionsz ' module has incorrect options: z%' module has incorrect instructions: )�json�loads� TypeError�
ValueErrorr r r �itemsr �keys�set�issubset�supported_optionsr )�json_string�data�
json_error�supported_modules�name�instructionsr r s r �validate_json_modulesr/ . s � �U��z�+�&�&�����z�"� U� U� U��(�)C�D�D�*�T�����U���� .�/�/��"�j�j�l�l� � ���l��(�(�(��,�D�D� D� D�#'�(9�(>�(>�(@�(@�#A�#A�D� D�� �
� ��\�.�.�0�0�1�1�1�1��|�I�.�3�3�5�5�6�6�?�?�%�d�+�=�=�?�?�� �
� �0�d��d�d�d�<�PY�CZ�C_�C_�Ca�Ca�>b�>b�d�d�� � � +�9�5�;�;�=�=�
9�
9�
��U�&�t�S�%�8�8�8�8�
9�
� ��,�Z�D�Z�Z�t�L�DU�DU�DW�DW�?X�?X�Z�Z�� �
� � �Ks � �A�=�Ac � � t j dd�� � }|� ddt j �� � |� d�� � }|� d d
�� � }|� dd
d�� � |� ddd�� � |� d�� � }|� ddt �� � |� ddd�� � |� dd�� � }|� dddd�� � |� dd�� � }|� dd �� � }|� d!t t � � � � �"� � |�
| � � }|S )#z2
Arg parser for cloudlinux-wizard utility
zcloudlinux-wizardz)Utility for installing cloudlinux modules)�prog�descriptionz--json�
store_true)�action�help� subparser)�dest�installzLInstall a module. The installation is performed in the background by default)r5 z
--no-asynczInstall in the foreground)r5 r4 z--forcez4Force the installer to ignore existing installationsT)�requiredz--json-dataz!JSON with modules to be installed)r5 �typez--resumez@Restart the installation process with previously given arguments�statusz(Return JSON with statuses of all modulesz --initialz-izGet the current modules' status�finishz6Finalize the installation from UI and close the wizard�cancelz+Remove a module from the installation queue�module)�choices)r �ArgumentParser�add_argument�SUPPRESS�add_subparsers�
add_parser�add_mutually_exclusive_groupr/ r r �
parse_args) �argv�parserr6 �install_parser�installer_group�
status_parser�
finish_parser�
cancel_parser�optss r �parse_cloudlinux_wizard_optsrO L s� � � �
$�
�?�� � �F�
�����H�<M��N�N�N��%�%�;�%�7�7�I��)�)��
[� *� � �N� ����6�|� � � � � ����
C�� � � � � %�A�A�4�A�P�P�O�� � ��
0�
"� !� � � �
� � ��
O�� !� � � � �(�(��A� )� � �M� ����T�,�5V� � � � � �(�(��O� )� � �M� �(�(��D� )� � �M� ���x��6K�6M�6M�1N�1N��O�O�O����T�"�"�D��Kr )
r r �re�clwizard.modulesr �compiler r r r r r/ rO � r r �<module>rT s� �� ���� ���� � � � � 2� 2� 2� 2� 2� 2��b�j�/�0�0��#�� �,�-� �<� <� <�
�� � �2� � �<6� 6� 6� 6� 6r