%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/lsapi.cpython-37.pyc

B

�2Lb��@s�ddlmZddlZddlmZddlmZddlmZm	Z	ddl
mZddlm
Z
ddlmZmZmZmZdd	lmZmZmZd
dlmZdZGd
d�de�ZdS)�)�absolute_importN)�contextmanager)�Feature)�Dict�List)�MODULES_LOGS_DIR)�InstallationFailedException)�ExternalProgramFailed�is_ea4�is_litespeed_running�is_testing_enabled_repo)�is_da�get_apache_modules�get_boolean_param�)�WizardInstallerz(/usr/local/directadmin/custombuild/buildcs�eZdZej�ed�ZddgZdZ	dZ
dZej
Z�fdd�Zd	d
�Zdd�Zeed
�dd��Zedd�dd�Zdd�Zedd��Zdd�Zdd�Zdd�Z�ZS)�LsapiInstallerz	lsapi.logZliblsapizliblsapi-develzea-apache24-mod_lsapiZ	mod_lsapiz/usr/bin/switch_mod_lsapicsRtt|���|jdd�|_t�r4|j�|j�n|j�|j�t	�pJg|_
dS)N)�superr�__init__�GENERAL_PACKAGE_LIST�lsapi_packagesr
�append�EA4_LSAPI_PACKAGE�GENERAL_LSAPI_PACKAGEr�apache_modules)�self)�	__class__��G/opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/lsapi.pyr)szLsapiInstaller.__init__c
Cs�g}x"|jD]}|�|�s|�|�qW|r�y|j|�}Wn:tk
rt}z|j�dt|��t��Wdd}~XYnX|j�	d|�n|j�	d�dS)zH
        Install lsapi packages if needed
        :return: None
        zYum failed with error: %sNz*Yum package was installed successfully: %szASkip yum package installation, all packages are already installed)
r�_is_package_installedrZ_install_yum_packager	Z
app_logger�error�strr�info)rZpackages_to_install�package�out�errr�_install_lsapi_packages2s
z&LsapiInstaller._install_lsapi_packagescCs4y|�|jdg�Wntk
r.t��YnXdS)zT
        Configure lsapi on package base installation
        :return: None
        z--setupN)�_run_command�UTILITYr	r)rrrr�_initialize_lsapiEsz LsapiInstaller._initialize_lsapi)�use_betaccsPtdd�}|r$|s$|�tdddg�z
dVWd|rJ|sJ|�tdddg�XdS)z�
        Context manager for set option `cloudlinux_beta` in DA custombuild
        @param use_beta: True == `cloudlinux_beta=yes`, False == `cloudlinux_beta=no`
        z//usr/local/directadmin/custombuild/options.confZcloudlinux_beta�setZyesNZno)rr'�_DA_CUSTOMBUILD)rr*Zinital_staterrr�use_cl_beta_on_daOs

z LsapiInstaller.use_cl_beta_on_daN)r*�returnc	CszyZ|j|d��D|�tdg�|�tdddg�|�tddg�|�tdg�Wd	QRXWntk
rtt��YnXd	S)
zP
        Configure and build lsapi on DirectAdmin
        :return: None
        )r*�updater+Z	php1_modeZlsphpZphp�nZapacheN)r-r'r,r	r)rr*rrr�_install_lsapi_on_da_sz#LsapiInstaller._install_lsapi_on_dacCs>t�r*d|kr|d}nt�}|�|�n|��|��dS)zC
        Install lsapi in the system
        :return: None
        �use_beta_for_daN)r
rr1r&r))rZoptionsr2rrr�run_installationms
zLsapiInstaller.run_installationcCsdhS)Nr2r)�clsrrr�supported_options|sz LsapiInstaller.supported_optionscCs:g}t�r|�ddi�d|jkr6|�dddid��|S)zo
        Get a list of warnings that should be shown in wizard before the module
        installation.
        �messagez?Installation will be performed via DirectAdmin Custombuild toolZ
suexec_modulez�mod_suexec is not installed. It is recommended to use mod_suexec with mod_lsapi. It is also required for CRIU to work. Please see %(url)s for more information.�urlz1https://docs.cloudlinux.com/apache_mod_lsapi.html)r6�context)r
rr)r�warningsrrr�
_get_warnings�s

zLsapiInstaller._get_warningscCs^g}t�r|�dddid��d|jkr<|�dddid��d|jkrZ|�dddid��|S)	zQ
        Get a list of possible blockers to disable module in Wizard UI.
        zxThe server is running under Litespeed. mod_lsapi works with Apache server only. Please see %(url)s for the requirements.r7z1https://docs.cloudlinux.com/apache_mod_lsapi.html)r6r8Zruid2_modulezcmod_ruid2 is enabled, it is not compatible with mod_lsapi. Please see %(url)s for the requirements.Zmpm_itk_modulezaMPM ITK is enabled, it is not compatible with mod_lsapi. Please see %(url)s for the requirements.)rrr)r�blockersrrr�
_get_blockers�s

zLsapiInstaller._get_blockerscsTdt�fdd��jD��i}���}|r6|�d|i����}|rP|�d|i�|S)NZalready_configuredc3s|]}��|�VqdS)N)r)�.0Zpkg)rrr�	<genexpr>�sz0LsapiInstaller.initial_status.<locals>.<genexpr>r9r;)�allrr:r/r<)r�resultr9r;r)rr�initial_status�szLsapiInstaller.initial_status)�__name__�
__module__�__qualname__�os�path�joinrZLOG_FILErrrr(rZLSAPIZ_REQUIRED_CL_COMPONENT_SUPPORTrr&r)r�boolr-r1r3�classmethodr5r:r<rA�
__classcell__rr)rrr!s"	
'r)Z
__future__rrE�
contextlibrZclcommon.constr�typingrrZclwizard.constantsrZclwizard.exceptionsrZclcommon.utilsr	r
rrZcldetectlibr
rr�baserr,rrrrr�<module>	s

Zerion Mini Shell 1.0