From 32d25b5344e0db04e9d109405287e858ffbd3795 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sun, 2 Aug 2026 02:28:11 -0400 Subject: [PATCH] [FIX] qemu ssh: one name per Host, the chained one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A nested VM was written as « Host erplibre-ubuntu-2404 test-vm_02+erplibre-ubuntu-2404 » — two patterns on one Host line. Valid ssh syntax, but the short name only repeats the tail of the chain and buys nothing, so it is gone. Nested hosts now carry the chained name alone. Existing configs repair themselves: replacing a block drops any whose name list intersects the new one, so the old two-name line is removed as a whole and rewritten with the single chained name — no stale short entry left behind. Verified on a config holding exactly the reported line, alongside an unrelated host that must survive. The naming rule is simpler too: a chain cannot collide with another machine, so there is no case left where a short name has to be preferred or avoided. Co-Authored-By: Claude Opus 4.8 (1M context) --- script/todo/todo.py | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/script/todo/todo.py b/script/todo/todo.py index 2ec3215..9491ac4 100755 --- a/script/todo/todo.py +++ b/script/todo/todo.py @@ -1664,9 +1664,7 @@ class TODO: self._write_ssh_config_entry( name, "erplibre", ip, identity_file=identity ) - entries.append( - {"names": [name], "ip": ip, "parent": None, "chain": name} - ) + entries.append({"names": [name], "ip": ip, "parent": None}) taken.add(name) chain_of[name] = name frontier.append(name) @@ -1703,33 +1701,25 @@ class TODO: if not ip: print(f" ⏭ {parent} › {child}: {t('no IP')}") continue - # Le nom CHAÎNÉ dit où vit la VM ; le nom court est plus - # agréable à taper. UN SEUL bloc porte les deux — ssh - # accepte plusieurs noms sur la ligne Host — et le court - # n'est retenu que s'il est libre, pour ne jamais masquer - # une autre machine. + # UN SEUL nom, le nom CHAÎNÉ : il dit où vit la VM et ne + # peut heurter aucune autre machine. Y ajouter le nom + # court ne ferait que répéter la fin de la chaîne. chain = f"{chain_of[parent]}+{child}" if chain in taken: continue # déjà vu (cycle) - names = [chain] if child in taken else [child, chain] self._write_ssh_config_entry( - names, + chain, "erplibre", ip, proxy_jump=parent, identity_file=identity, ) entries.append( - { - "names": names, - "ip": ip, - "parent": parent, - "chain": chain, - } + {"names": [chain], "ip": ip, "parent": parent} ) - taken.update(names) - chain_of[names[0]] = chain - next_frontier.append(names[0]) + taken.add(chain) + chain_of[chain] = chain + next_frontier.append(chain) frontier = next_frontier print(f"\n── {t('SSH hosts written')} ──")