every libs/*.py and hooks/*.py now starts with a one-line module docstring; every bin/* script starts with a `# purpose:` header. discovery-by-`ls`-and-read instead of by index. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
12 lines
453 B
Python
12 lines
453 B
Python
"""known_hosts: pre-apply hook that writes all nodes' ssh/is_known_as entries to ~/.ssh/known_hosts_ckn."""
|
|
|
|
from os.path import expanduser
|
|
|
|
|
|
def apply_start(repo, target, nodes, interactive=False, **kwargs):
|
|
with open(expanduser('~/.ssh/known_hosts_ckn'), 'w+') as file:
|
|
file.write('\n'.join(sorted(
|
|
line
|
|
for node in repo.nodes
|
|
for line in node.metadata.get('ssh/is_known_as', set())
|
|
)))
|