관리-도구
편집 파일: migrate.cpython-311.pyc
� IMg � � � d Z ddlZddlZddlmZ ddlmZ ddlZddl m Z ddlmZ ddl mZ ddl mZ dd l mZ dd lmZ ddlmZ ddlmZ dd lmZ ee� � ZdZd� Z e� � fd�Zded�d�Zedk 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)�bool_from_envvar)�Router)�systemd_notifier)�db)� tls_checkz/usr/bin/imunify-residentc � � | dk rdS dS )z Check if go service is supportedzim360.run_residentFT� )� start_pkgs �L/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/migrate.py�is_go_supportedr s � � �(�(�(��u��4� c �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 r �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)�defence360agent)r r c � � t j t j � � |� � t j j � � � t j t j j � � t t j t j � � t � d� � t j t j j � � t% dt'