관리-도구
편집 파일: 002_convert_serialized_scans.cpython-311.pyc
� ��g � � � d Z ddlZddlZddlZddlZddlmZ ej e� � Z ed� � Z d� Zdd�d�Zdd�d �Z dS ) u This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see <https://www.imunify360.com/legal/eula> Convert serialized scans classes to dicts. In most cases it should be already done in 001_fix_scan_unserialization, but it is still necessary for those who have already updated to 7.1.0 before running 001_fix_scan_unserialization migration. See DEF-24115 for details. � N)�Pathz$/var/imunify360/aibolit/scans.picklec �� � |� |j dz � � }|� d� � 5 }t j | |� � d d d � � n# 1 swxY w Y |� |� � d S )Nz.temp�wb)� with_name�name�open�pickle�dump�replace)�obj�path� temp_path�fs �a/opt/imunify360/venv/lib/python3.11/site-packages/imav/migrations/002_convert_serialized_scans.pyr r ) s� � ����t�y�7�2�3�3�I� ���� � � ����C������ � � � � � � � � � ���� � � � � ���d�����s �A�A�AF)�fakec �� � |st � � � sd S dt � � � v r� t � d� � 5 }t j |� � }d d d � � n# 1 swxY w Y t j d� |D � � � � }t |t � � d S # t $ r,}t � dt |� � Y d }~d S d }~ww xY wd S )Ns imav.malwarelib�rbc 3 � K � | ]A}|j |j |j |j |j |j |j j |j j d �V � �BdS ))r �scanid� scan_type�created�started�args� resource_type�stateN) r r r r r r r �valuer )�.0�items r � <genexpr>zmigrate.<locals>.<genexpr>; sn � � � � (� (� � !�I�"�k�!%��#�|�#�|� �I�%)�%7�%=�!�Z�-� � �(� (� (� (� (� (� z"Failed to load pickle scans %s: %s)� SCANS_PATH�exists� read_bytesr r �load�collections�dequer � Exception�logger� exception)�migratorr �_�__r �scans�updated�excs r �migrater0 2 s_ � �� �:�$�$�&�&� ����Z�2�2�4�4�4�4� &�����&�&� '�!���A���� '� '� '� '� '� '� '� '� '� '� '���� '� '� '� '� "�'� (� (� "�(� (� (� � �G�$ ��*�%�%�%�%�%�� � � � ����4�j�#� � � � � � � � � ����� ����% 5�4s; �B5 �A5�)B5 �5A9�9B5 �<A9�=!B5 �5 C+�?!C&�&C+c � � d S )N� )r* r r+ r, s r �rollbackr3 P s � ��Dr )�__doc__r% � importlib�loggingr �pathlibr � getLogger�__name__r( r! r r0 r3 r2 r r �<module>r: s� ��� �: � � � � � � � � ���� � � � � � � � � � � �� �8� $� $�� �T�8� 9� 9� �� � � %� &� &� &� &� &�<