INNER CODE UNIT · Python

validate_manual_plugin

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

def validate_manual_plugin(plugin_data: Dict[str, Any], plugin_path: Path, *, log_invalid: bool = True) -> bool:
    try:
        valid, message = get_plugin_validator()._Configurator__validate_plugin(deepcopy(plugin_data))
    except (AttributeError, KeyError, OSError, TypeError, ValueError) as e:
        if log_invalid:
            LOGGER.error(f"Ignoring invalid manual plugin {plugin_path.name}: {e}")
        return False
    if not valid and log_invalid:
        LOGGER.error(f"Ignoring invalid manual plugin {plugin_path.name}: {message}")
    return valid


def generate_caches() -> Set[str]:
    """Restore all ``bw_jobs_cache`` rows to disk.

    Returns a set of ``plugin_id/job_name`` identifiers for any cache files whose
    extraction or write failed. Callers can use this to avoid downstream actions
    (e.g. re-caching empty state) for affected plugins.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…