l#gZdZddlZddlZddlmZddlmZddlmZddl Z ddl m Z ddl mZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$ee%Z&dZ'dZ(e)fdZ*deddZ+e%dkr e+dSdS)zbThis module import peewee_migrate and apply migrations, for Imunify-AV it's entrypoint for serviceN) getLogger)Path)migrator)app) configure)Core)Model)bool_from_envvar)Router)systemd_notifier) hosting_panel)cPanel) DirectAdmin)Plesk)db) tls_check) is_cloudwaysz/usr/bin/imunify-residentc|dkrdS ddlmcm}n+#t$rtdYdSwxYwt p:tjj tj ko| S)z Check if go service is supporteddefence360agentFrNz!imunify360 was not found on start) im360.subsys.csfsubsyscsf ImportErrorloggerwarningrr HostingPanelNAMEris_csf_is_running_sync) start_pkgrs L/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/migrate.pyis_go_supportedr!!s%%%u&&&&&&&&&&  :;;;uu  >> "$$)V[8 -**,, ,s $<<cXtdtjtjjt jtj tj |D]\}}tj d|d| tj d5tt|t}tt_|dddn #1swxYwYtjdS#tjwxYw)z4Apply migrations: restructure db, config files, etc.zApplying database migrations...zATTACH 'z' AS EXCLUSIVE)migrations_dirsrN)rinfor notify AgentState MIGRATINGrresetrinitr PATH execute_sqlatomicr rLOGGERrunclose)r$ attached_dbsdb_path schema_namerouters r apply_migrationsr55sG KK1222,7ABBBOGEJ ,?? ='== ==>>>> Y{ # #   /F%HO JJLLL                  s1D&AC4( D4C88D;C8<DD)r)rrctjtj|tjjtj tj j ttjtjt dtj tj jt%dt'|}|rqtjdt dtjt.t.gt0jddzdStjd tjt0jt0jd d |gt0jddzdS) zoEntry point for Imunify-AV service. Apply migrations, and then replace process with {start_pkg}.run module.zStarting main process... I360_USE_GO)defaultT)exist_okzRun imunify-resident serviceN) missing_okz-mz{})osumaskr FILE_UMASKr internalsr reconfigurer r&r'READYr5rMIGRATIONS_DIRSMIGRATIONS_ATTACHED_DBSr%STARTINGr r! GO_FLAG_FILEtouchexecvGO_SERVICE_NAMEsysargvunlink executableformat)rruse_gos r r/r/QsHT_ IKKK$00222,7=>>>S(#*EFFF KK*+++,7@AAA y99F  ... 2333   hqrrl         D 111  N ^T4;;y#9#9 :SXabb\ I     __main__),__doc__r<rIloggingrpathlibrpeewee_migrater defence360agent.internals.loggerrdefence360agent.applicationr$defence360agent.application.settingsr defence360agent.contracts.configrr r defence360agent.routerr defence360agent.subsysr defence360agent.subsys.panelsr $defence360agent.subsys.panels.cpanelr)defence360agent.subsys.panels.directadminr#defence360agent.subsys.panels.pleskrdefence360agent.model.instancerdefence360agent.modelrdefence360agent.utilsr__name__rrHr!tupler5r/rOr res ######''''++++++::::::111111222222======))))))333333777777777777AAAAAA555555------++++++...... 8  -(495778')     B zCEEEEErO