x )pddlZddlZddlZddlmZejdZdhZdhZhdZ dZ dZ d Z dS) N)get_supported_modulesz\A\d+(\.\d+){0,2}\Zversionsdefault_version>enable_selectoruse_beta_for_daenable_for_new_usersenable_for_existing_usersc B|tvr2t|tstjd|d|ddS|t vrt|t stjd|d|d|D]N}t|trt |stjd|d|d|OdS|tvrLt|trt |stjd|d|d|dSdS)N'z' module option 'z' must be a booleanz' must be a listz' contains invalid version: z' has invalid version: ) _BOOL_OPTIONS isinstanceboolargparseArgumentTypeError_VERSION_LIST_OPTIONSliststr _VERSION_REmatch_VERSION_STRING_OPTIONS) module_namekeyvaluevers py/clwizard/parser.py_validate_option_valuers m%&& ,JKJJ#JJJ    % % %%&& ,GKGG#GGG   Cc3'' {/@/@/E/E 09 99c991499    ' ' '%%% [->->u-E-E ,2K22#22(-22  ( '  c  tj|}n.#ttf$r}t jd|d}~wwxYwt }|D]e\}}||vr9t jd|dt| dt| vrt|d  || s?t jd|dt|d |dD]\}}t|||*|r9t jd|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: )jsonloads TypeError ValueErrorrrritemsrkeyssetissubsetsupported_optionsr) json_stringdata json_errorsupported_modulesname instructionsrrs rvalidate_json_modulesr/.sUz+&& z "UUU()CDD*TU.//"jjlll ( ( (,DDDD#'(9(>(>(@(@#A#ADD  \..0011 1 1|I.335566??%d+==?? 0ddddb>bdd+95;;== 9 9 U&tS%8888 9  ,ZDZZtLDUDUDWDW?X?XZZ   KsA=Ac tjdd}|ddtj|d}|d d }|d d d|ddd|d}|ddt|ddd|dd }|dddd|dd }|dd }|d!tt"| |}|S)#z2 Arg parser for cloudlinux-wizard utility zcloudlinux-wizardz)Utility for installing cloudlinux modules)prog descriptionz--json store_true)actionhelp subparser)destinstallzLInstall a module. The installation is performed in the background by default)r5z --no-asynczInstall in the foreground)r5r4z--forcez4Force the installer to ignore existing installationsT)requiredz --json-dataz!JSON with modules to be installed)r5typez--resumez@Restart the installation process with previously given argumentsstatusz(Return JSON with statuses of all modulesz --initialz-izGet the current modules' statusfinishz6Finalize the installation from UI and close the wizardcancelz+Remove a module from the installation queuemodule)choices) rArgumentParser add_argumentSUPPRESSadd_subparsers add_parseradd_mutually_exclusive_groupr/rr parse_args) argvparserr6install_parserinstaller_group status_parser finish_parser cancel_parseroptss rparse_cloudlinux_wizard_optsrOLs $ ?F  HrTs 222222bj/00 # ,-<<< 2<66666r