#!/usr/bin/env python3 """Regles partagees pour les inventaires statiques Set-OPS.""" from __future__ import annotations from pathlib import Path GROUPES_OPERATIONNELS_PREFIXES = ("serveurs_", "clients_") GROUPE_HOTES_ACTIFS = "hotes_actifs" GROUPE_HOTES_PLANIFIES = "hotes_planifies" GROUPES_ETAT_HOTE = {GROUPE_HOTES_ACTIFS, GROUPE_HOTES_PLANIFIES} def est_groupe_operationnel(groupe: str) -> bool: return groupe.startswith(GROUPES_OPERATIONNELS_PREFIXES) def groupes_operationnels_connus(enfants: dict, dossier_playbooks: Path) -> list[str]: groupes = set(enfants) groupes.update(playbook.stem for playbook in dossier_playbooks.glob("*.yml")) return sorted(groupe for groupe in groupes if est_groupe_operationnel(groupe))