gddlZddlmZddlmZddlmZddlmZm Z ddl m Z ddl m Z dd lmZGd d eZdS) N)Feature)ExternalProgramFailed)check_cagefs_initialized)CageFsCageFsException)MODULES_LOGS_DIR)InstallationFailedException)WizardInstallerceZdZejedZej Z fdZ dZ dZ dZdZdZdZed Zd ZxZS) CagefsInstallerz cagefs.logc|tt|j|_dS)N)logger)super__init__r app_loggercgfs)self __class__s py/clwizard/modules/cagefs.pyrzCagefsInstaller.__init__s1 $/222 c|j}|j}|jd||dkr|jdSdS)z` Enable all users statuses and after it toggle to initial mode :return: z.Cagefs users status was updated to enabled: %s Disable AllN)r get_user_modeset_enabled_moderinfotoggle_user_mode)r initial_modeouts r_enable_existing_usersz&CagefsInstaller._enable_existing_userssp y..00 i((** MsSSS = ( ( I & & ( ( ( ( ( ) (rc|j}|jd||dkrO|jd|j|jddSdS)NzCurrent mode is: %srzTry to set mode to Enable allzMode was toggled to Enable all)rrrrr)rmodes r_set_enabled_modez!CagefsInstaller._set_enabled_mode'sy&&(( 2D999 = O !@ A A A I & & ( ( ( O !A B B B B B ! rc|ds9 |ddS#t$r}t|d}~wwxYw|jddS)Ncagefsz2Skip package installation, it is already installed)_is_package_installed_install_packagerr rr)rerrs r_install_cagefs_packagez'CagefsInstaller._install_cagefs_package/s))(33 W =%%h/////( = = =133< = O !U V V V V Vs. A AA cVts |j}|jd|dS#t $r<}|jdt|t|d}~wwxYw|jddS)NzCagefs was initialized: %sz+Cagefs initialization failed with error: %sz8Initializing was skipped, cagefs was already initialized) rrinitialize_cagefsrrrerrorstrr rrr(s r_initialize_cagefsz"CagefsInstaller._initialize_cagefs8s')) ] =i1133$$%A3GGGGG" = = =%%&SUXY\U]U]^^^133< = O ![ \ \ \ \ \s4A B 7BB c |j}|jd|dS#t$r}t |d}~wwxYw)Nz/Cagefs was enabled, ready for configuration %s)r enable_cagefsrrrr r.s r_enable_cagefszCagefsInstaller._enable_cagefsCsg 9)))++C O !SUX Y Y Y Y Y 9 9 9-//S 8 9s48 AAAc||| |dr||dr|dSdS#t $r<}|jdt|t|d}~wwxYw)Nenable_for_existing_usersenable_for_new_userszCan`t configure options: %s) r)r/r2r r#rrr,r-r )roptionsr(s rrun_installationz CagefsInstaller.run_installationJs $$&&& !!!  923 .++----. )&&((((( ) ) 9 9 9 O ! !"?S J J J-//S 8 9s8A:: C7B;;Cc ddhS)Nr4r5)clss rsupported_optionsz!CagefsInstaller.supported_optionsWs+-CDDrc |jdk}n,#t$r|jdd}YnwxYwt t d|idS)Nz Enable Allz?Unable to detect cagefs mode, assuming that it is "Disable All"Fr5)already_configuredr6)rrrrwarningboolr)renabled_for_news rinitial_statuszCagefsInstaller.initial_status[s $"i5577<GOO $ $ $ O # #Q   $OOO  $#''?'A'A"B"B.@    s &A A )__name__ __module__ __qualname__ospathjoinrLOG_FILErCAGEFS_REQUIRED_CL_COMPONENT_SUPPORTrr r#r)r/r2r7 classmethodr;rA __classcell__)rs@rr r sw||,l;;H%,^"33333 ) ) )CCCWWW ] ] ]999 9 9 9EE[E       rr )rEclcommon.constrclcommon.utilsr!clconfig.cagefs_statistics_configrcllimits.cagefs_librrclwizard.constantsrclwizard.exceptionsr baser r r9rrrTs """"""000000FFFFFF77777777//////;;;;;;!!!!!!V V V V V oV V V V V r