Server IP : 66.29.132.122 / Your IP : 3.138.69.214 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/migrations/ |
Upload File : |
import logging import shutil import gzip import os from defence360agent.contracts.config import Logger from defence360agent.internals.logger import get_log_file_names logger = logging.getLogger(__name__) def migrate(migrator, database, fake=False, **kwargs): for filename in get_log_file_names(): for i in range(1, Logger.BACKUP_COUNT + 1): source = "%s.%d".format(filename, i) dest = "%s.gz".format(source) try: if os.path.exists(source): with open(source, "rb") as f_in, gzip.open( dest, "wb" ) as f_out: shutil.copyfileobj(f_in, f_out) os.remove(source) except Exception as e: logger.exception( "Failed file %s compression with %s", source, e ) def rollback(migrator, database, fake=False, **kwargs): """Write your rollback migrations here.""" pass