INNER CODE UNIT · Python

custom_configs_save_failed

bunkerity/bunkerweb · src/scheduler/main.py:863

def custom_configs_save_failed(err: str) -> bool:
    """Whether save_custom_configs refused the write, as opposed to reporting on it.

    Its return value is one overloaded string: a per-config warning means the rest of the payload
    landed, anything else means nothing was written. The caller cannot read it as a boolean, because
    on a refused write it regenerates /etc/bunkerweb/configs from the database and writes it over
    the edit that is still only on disk.
    """
    return any(not (line.startswith("Service ") and line.endswith(" not found, please check your config")) for line in err.splitlines() if line.strip())


def check_configs_changes(*, generate: bool = True) -> Optional[bool]:
    # Checking if any custom config has been created by the user
    assert SCHEDULER is not None, "SCHEDULER is not defined"
    LOGGER.info("Checking if there are any changes in custom configs ...")
    custom_configs = []
    db_configs = SCHEDULER.db.get_custom_configs()
    changes = False

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…