} d dl Z d dlmZ d dlmZ d dlmZ d dlmZm Z d dl
mZ d dlm
Z
dd lmZ G d
de ZdS ) N)Feature)ExternalProgramFailed)check_cagefs_initialized)CageFsCageFsException)MODULES_LOGS_DIR)InstallationFailedException )WizardInstallerc e Zd Zej ed Zej Z
fdZd Zd Z
d Zd Zd Zd Zed Zd
Z xZS )CagefsInstallerz
cagefs.logc | t t | j | _ d S )N)logger)super__init__r
app_loggercgfs)self __class__s py/clwizard/modules/cagefs.pyr zCagefsInstaller.__init__ s1
$/222 c | j }| j }| j d| |dk r| j dS dS )z`
Enable all users statuses and after it toggle to initial mode
:return:
z.Cagefs users status was updated to enabled: %sDisable AllN)r
get_user_modeset_enabled_moder infotoggle_user_mode)r initial_modeouts r _enable_existing_usersz&CagefsInstaller._enable_existing_users sp
y..00i((**MsSSS=((I&&((((( )(r c | j }| j d| |dk rO| j d | j | j d d S d S )NzCurrent mode is: %sr zTry to set mode to Enable allzMode was toggled to Enable all)r r r r r )r modes r _set_enabled_modez!CagefsInstaller._set_enabled_mode' s y&&((2D999= O !@AAAI&&(((O !ABBBBB ! r c | d s9 | d d S # t $ r}t |d }~ww xY w| j d d S )Ncagefsz2Skip package installation, it is already installed)_is_package_installed_install_packager r r r )r errs r _install_cagefs_packagez'CagefsInstaller._install_cagefs_package/ s ))(33 W
=%%h/////(
=
=
=133<
=
O !UVVVVVs .
AAAc V t s | j }| j d| d S # t
$ r<}| j dt | t |d }~ww xY w| j d d S )NzCagefs was initialized: %sz+Cagefs initialization failed with error: %sz8Initializing was skipped, cagefs was already initialized) r r initialize_cagefsr r r errorstrr r r r( s r _initialize_cagefsz"CagefsInstaller._initialize_cagefs8 s ')) ]
=i1133$$%A3GGGGG"
=
=
=%%&SUXY\U]U]^^^133<
=
O ![\\\\\s 4A
B7BBc | j }| j d| d S # t $ r}t |d }~ww xY w)Nz/Cagefs was enabled, ready for configuration
%s)r
enable_cagefsr r r r r. s r _enable_cagefszCagefsInstaller._enable_cagefsC sg 9)))++CO !SUXYYYYY 9 9 9-//S8 9s 48
AAAc | | | |d r| |d r| d S d S # t
$ r<}| j dt | t |d }~ww xY w)Nenable_for_existing_usersenable_for_new_userszCan`t configure options: %s)
r) r/ r2 r r# r r r, r- r )r optionsr( s r run_installationz CagefsInstaller.run_installationJ s $$&&&!!! 923
.++----.
)&&(((((
)
) 9 9 9O!!"?SJJJ-//S8 9s 8A: :
C 7B;;C c
ddhS )Nr4 r5 )clss r supported_optionsz!CagefsInstaller.supported_optionsW s +-CDDr c | j dk }n,# t $ r | j d d}Y nw xY wt t
d|idS )Nz
Enable Allz?Unable to detect cagefs mode, assuming that it is "Disable All"Fr5 )already_configuredr6 )r r r r warningboolr )r enabled_for_news r initial_statuszCagefsInstaller.initial_status[ s $"i5577<GOO $ $ $O##Q
$OOO $ #''?'A'A"B"B.@
s &A A )__name__
__module____qualname__ospathjoinr LOG_FILEr CAGEFS_REQUIRED_CL_COMPONENT_SUPPORTr r r# r) r/ r2 r7 classmethodr; rA
__classcell__)r s @r r
r
s w||,l;;H%,^"3 3 3 3 3 ) ) )C C CW W W ] ] ]9 9 99 9 9 E E [E
r r
)rE clcommon.constr clcommon.utilsr !clconfig.cagefs_statistics_configr cllimits.cagefs_libr r clwizard.constantsr clwizard.exceptionsr baser r
r9 r r