/LddlZddlZddlZddlmZddlmZddlmZddl m Z m Z ddl m Z mZedejd Zd Zd Zd Zd ZdS)N) setup_logging)cpusers)get_pw)get_suites_allowed_pathget_admin_config_permissions)CAGEFS_MP_FILENAMEremove_mount_dir_cagefsconfigs_migrationz%/var/log/clwpos/configs_migration.log) caller_name file_level logfile_pathctj||t|\}}}tj|D]M}tj||}tj|||tj||NdS)N) shutilcopy2roslistdirpathjoinchownchmod)sourcetargetgidownergroupmodeitem full_paths py/clwpos/migrations/configs.py_copy_with_permsr s L   5c::E5$ 6""""GLL..  E5))) D!!!!""c"tdS)zM Migrate configs stored on CloudLinux Solo Edition: /var/clwpos/solo N)migrate_solo_edition_configr!rmigrate_configsr%s !!!!!r!c|stddStD]}t|}|j|j}}t jt|}t j |st j |dd|D]}t|||dS)Nz&Nothing to do, no configs in directory)usernameiF)exist_ok) _loggerinforrpw_uidpw_gidrrdirnamerexistsmakedirsr )files_to_be_movedr'pw_infouidrrrs r_transfer_config_filesr3#s  =>>>II..(+++>7>Sw6s;;<<w~~d## 5 Kee 4 4 4 4% . .D T4 - - - - ...r!cdg}tjr fdtjD}t |tjt rt dddtjrtjdSdS)Nz/var/clwpos/solocPg|]"}tj|#Sr$)rrr).0rsolo_dirs r z/migrate_solo_edition_config..7s)[[[dRW\\(D99[[[r!z!/var/clwpos/soloT)remount_cagefsremount_in_background) rrr.rr3rr rrmtree)r0r7s @rr#r#2s!H w~~h\[[[[bjQYFZFZ[[[,--- w~~())< 3/36: < < < < w~~h  h  r!)loggingrrclwpos.logsetuprclcommon.cpapir clwpos.utilsrclwpos.feature_suitesrrclcommon.clcagefsrr INFOr)r r%r3r#r$r!rrCs ))))))""""""JIIIIIII -#|8    """""" . . .     r!