OwlCyberSecurity - MANAGER
Edit File: migrate.cpython-311.opt-1.pyc
� ��Jh � �2 � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl Zddlm Z ddlmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZmZmZ ee� � Z dZ! e"� � fd�Z#d� Z$ded�d�Z%edk r e%� � dS dS )zbThis module import peewee_migrate and apply migrations, for Imunify-AV it's entrypoint for service� N)� getLogger)�migrator)�app)� configure)�Core)�Model)�Router)�systemd_notifier)�db)� tls_check)�write_pid_file�IM360_RESIDENT_PID_PATH�cleanup_pid_filez/usr/bin/imunify-residentc �X � t � d� � t j t j j � � t j � � t j t j � � |D ]\ }}t j d|� d|� �� � � t j d� � 5 t t | t �� � }t t _ |� � � ddd� � n# 1 swxY w Y t j � � dS # t j � � w xY w)z4Apply migrations: restructure db, config files, etc.zApplying database migrations...zATTACH 'z' AS � EXCLUSIVE)�migrations_dirs�loggerN)r �infor �notify� AgentState� MIGRATINGr �resetr �initr �PATH�execute_sql�atomicr r �LOGGER�run�close)r �attached_dbs�db_path�schema_name�routers �L/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/migrate.py�apply_migrationsr% # sG � � �K�K�1�2�2�2���,�7�A�B�B�B� �O�����G�E�J���� ,� ?� ?���� ��=�'�=�=��=�=�>�>�>�>�� �Y�{� #� #� � ��� /��� � �F� %�H�O��J�J�L�L�L� � � � � � � � � � � ���� � � � � �� � � � � ���� � � � ���s1 �D �&AC4�(D �4C8�8D �;C8�<D �D)c � � t � d| � � t � dt j � � t j t j � � t � d� � t j d� � d S )Nz$Received signal %s in signal_handlerz0waiting %d seconds so that migrations can finish�Exitingr ) r �warningr �%SIGNAL_HANDLER_MIGRATION_TIMEOUT_SECS�time�sleepr �sys�exit)�sig�_s r$ �signal_handlerr0 @ sn � � �N�N�9�3�?�?�?� �N�N�:��2�� � � �J�t�9�:�:�:� �K�K� �����H�Q�K�K�K�K�K� �defence360agent)� start_pkgr c � � t j t j t j fD ]}t j |t � � � | dk rt t � � t j t j � � |� � t j j � � � t j t"