reconstruire-locataire : eprouve d'armer a bilan ; le suivi ne duplique plus le journal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Allaire 2026-09-30 15:24:28 -04:00
parent 14bf977bd6
commit 5a6d0f28f6
2 changed files with 24 additions and 3 deletions

View file

@ -83,11 +83,11 @@ def sur_site(args, commande: str, filtre: tuple[str, ...] = ()) -> int:
"sudo -u setops bash -lc " + shlex.quote(distante)], filtre=filtre)
def sur_locataire(ip: str, commande: str, filtre: tuple[str, ...] = ()) -> tuple[int, str]:
def sur_locataire(ip: str, commande: str, journaliser: bool = True) -> tuple[int, str]:
distante = "sudo -u setops bash -lc " + shlex.quote(commande)
r = subprocess.run(SSH_NEUF + [f"ansible@{ip}", distante], capture_output=True, text=True,
stdin=subprocess.DEVNULL)
if JOURNAL:
if JOURNAL and journaliser:
with JOURNAL.open("a", encoding="utf-8") as f:
f.write(r.stdout + r.stderr)
return r.returncode, r.stdout
@ -194,7 +194,8 @@ def main() -> int:
time.sleep(30)
_, sortie = sur_locataire(runner_ip, f"pgrep -u setops -x make >/dev/null && echo EN_COURS; "
f"grep -E '^=== |^make.*Error|failed=[1-9]' "
f"{args.racine_runner}/monter-flotte.log")
f"{args.racine_runner}/monter-flotte.log",
journaliser=False) # le releve se repete : seul le NOUVEAU va au journal
for ligne in sortie.splitlines():
if ligne.startswith("===") or "Error" in ligne or "failed=" in ligne:
if ligne not in vu: