HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/cagefs.cpython-37.pyc
B

������|��@s�ddlmZddlZddlmZddlmZddlmZddl	m
Z
mZddlm
Z
ddlmZd	d
lmZGdd�de�ZdS)
�)�absolute_importN)�Feature)�ExternalProgramFailed)�check_cagefs_initialized)�CageFs�CageFsException)�MODULES_LOGS_DIR)�InstallationFailedException�)�WizardInstallercsteZdZej�ed�Zej	Z
�fdd�Zdd�Zdd�Z
dd	�Zd
d�Zdd
�Zdd�Zedd��Zdd�Z�ZS)�CagefsInstallerz
cagefs.logcs tt|���t|jd�|_dS)N)Zlogger)�superr�__init__r�
app_logger�cgfs)�self)�	__class__��py/clwizard/modules/cagefs.pyrszCagefsInstaller.__init__cCs8|j��}|j��}|j�d|�|dkr4|j��dS)z`
        Enable all users statuses and after it toggle to initial mode
        :return:
        z.Cagefs users status was updated to enabled: %szDisable AllN)r�
get_user_modeZset_enabled_moder�info�toggle_user_mode)rZinitial_mode�outrrr�_enable_existing_userss


z&CagefsInstaller._enable_existing_userscCsF|j��}|j�d|�|dkrB|j�d�|j��|j�d�dS)NzCurrent mode is: %szDisable AllzTry to set mode to Enable allzMode was toggled to Enable all)rrrrr)r�moderrr�_set_enabled_mode*s

z!CagefsInstaller._set_enabled_modec
CsV|�d�sFy|�d�WqRtk
rB}zt�|�Wdd}~XYqRXn|j�d�dS)NZcagefsz2Skip package installation, it is already installed)Z_is_package_installedZ_install_packagerr	rr)r�errrrr�_install_cagefs_package2s
z'CagefsInstaller._install_cagefs_packagec
Csrt�sby|j��}|j�d|�Wqntk
r^}z|j�dt|��t�|�Wdd}~XYqnXn|j�d�dS)NzCagefs was initialized: %sz+Cagefs initialization failed with error: %sz8Initializing was skipped, cagefs was already initialized)	rrZinitialize_cagefsrrr�error�strr	)rrrrrr�_initialize_cagefs;s
z"CagefsInstaller._initialize_cagefsc
CsLy|j��}|j�d|�Wn*tk
rF}zt�|�Wdd}~XYnXdS)Nz/Cagefs was enabled, ready for configuration
 %s)rZ
enable_cagefsrrrr	)rrrrrr�_enable_cagefsFs

zCagefsInstaller._enable_cagefsc
Cs~|��|��|��y$|dr*|��|dr:|��Wn<tk
rx}z|j�dt|��t	�|�Wdd}~XYnXdS)N�enable_for_existing_users�enable_for_new_userszCan`t configure options: %s)
rr r!rrrrrrr	)r�optionsrrrr�run_installationMsz CagefsInstaller.run_installationcCsddhS)Nr"r#r)�clsrrr�supported_optionsZsz!CagefsInstaller.supported_optionscCsLy|j��dk}Wn$tk
r6|j�d�d}YnXtt��d|id�S)Nz
Enable Allz?Unable to detect cagefs mode, assuming that it is "Disable All"Fr#)Zalready_configuredr$)rrrrZwarning�boolr)rZenabled_for_newrrr�initial_status^s
zCagefsInstaller.initial_status)�__name__�
__module__�__qualname__�os�path�joinrZLOG_FILErZCAGEFSZ_REQUIRED_CL_COMPONENT_SUPPORTrrrrr r!r%�classmethodr'r)�
__classcell__rr)rrrs	
r)Z
__future__rr-Zclcommon.constrZclcommon.utilsrZ!clconfig.cagefs_statistics_configrZcllimits.cagefs_librrZclwizard.constantsrZclwizard.exceptionsr	�baserrrrrr�<module>	s