Sindbad~EG File Manager

Current Path : /proc/thread-self/root/opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/migrations/
Upload File :
Current File : //proc/thread-self/root/opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/migrations/123_disable_scheduled_scan.py

import contextlib
import logging
import os

from defence360agent.contracts.config import (
    ConfigFile,
    MalwareScanSchedule,
    NONE,
)

logger = logging.getLogger(__name__)


def _update_config(path=None):
    config = {
        "MALWARE_SCAN_SCHEDULE": {
            "interval": NONE,
        }
    }

    try:
        config_file = ConfigFile(path=path)
        config_file.dict_to_config(config)
    except Exception:
        logger.exception("Failed to set malware scan schedule config")


def _remove_cron(path=MalwareScanSchedule.CRON_PATH):
    with contextlib.suppress(FileNotFoundError):
        os.unlink(path)


def migrate(migrator, database, fake=False, **kwargs):
    # Stubbed in DEF-11010
    # if fake:
    #     return
    #
    # _update_config()
    # _remove_cron()
    pass


def rollback(migrator, database, fake=False, **kwargs):
    pass

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists