kit du sysadmin : un lien underlay.yml qui mene a une carte n'est jamais redirige

Le kit de Mathieu, verifie sur le poste de Daniel, avait fait passer son
underlay.yml de SITE-Chezlepro a SITE-Technolibre (site d'attache du kit).
Le lien est desormais signale, et pose seulement s'il manque.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Allaire 2026-11-03 16:03:13 -05:00
parent 6b174dea8c
commit d10a6ec7fa
3 changed files with 49 additions and 7 deletions

View file

@ -9,12 +9,15 @@ bascule les noms d'un locataire entre sa production et sa releve. Ces cas garden
4. une ligne hors bloc qui declare les memes noms est un REFUS (elle gagnerait sur le bloc) ;
`adopter` la retire ;
5. la variante du bloc se relit sur sa ligne d'ouverture ;
6. un paquet `a|b` est satisfait par l'un ou l'autre.
6. un paquet `a|b` est satisfait par l'un ou l'autre ;
7. un lien `underlay.yml` qui mene a une autre carte n'est jamais redirige (le kit de Mathieu,
verifie sur le poste de Daniel, l'avait fait passer a SITE-Technolibre) ; absent, il se pose.
"""
from __future__ import annotations
import ast
import sys
import tempfile
from pathlib import Path
from unittest import mock
@ -78,6 +81,24 @@ def main() -> int:
verifier(kit._paquet_present("netcat-openbsd|netcat-traditional"), "6. a|b : l'un suffit")
verifier(not kit._paquet_present("netcat-openbsd"), "6. absent : manquant")
with tempfile.TemporaryDirectory() as d:
depots = Path(d)
for site in ("SITE-Chezlepro", "SITE-Technolibre"):
(depots / site).mkdir()
(depots / site / "underlay.yml").write_text("underlay: {}\n")
(depots / "Set-OPS-public").mkdir()
lien = depots / "Set-OPS-public" / "underlay.yml"
m = {"site": {"depot": "SITE-Technolibre"}}
lien.symlink_to("../SITE-Chezlepro/underlay.yml")
x = kit.ligne_underlay(depots, m)
verifier(x.info and x.ajout is None and "SITE-Chezlepro" in x.detail,
"7. un lien vers une autre carte : signale, aucun ajout propose")
lien.unlink()
x = kit.ligne_underlay(depots, m)
verifier(not x.ok and x.ajout() and Path.readlink(lien) == Path("../SITE-Technolibre/underlay.yml"),
"7. absent : se pose vers le site d'attache")
verifier(kit.ligne_underlay(depots, m).ok, "7. pose : satisfait")
if echecs:
print(f"\n{echecs} echec(s).")
return 1