testenv/ starts two real NetBox 4.7 instances (v2 and v1 token), SSH targets on public, mgmt, and prod networks, a jump host, an IPv6-only host, a static host, and a client with ssh, sftp, scp, tmux, zellij, bash, zsh, and fish. A seed script fills NetBox through the REST API. 141 end-to-end checks cover cache and refresh filters, connecting, all resolver strategies, multiple instances, shortcuts and rewrites, SSH options and rules, static hosts, sftp/scp incl. IPv6 and jump hosts, tunnels, local notes and NetBox comments, completion and shell hooks, the TUI (driven through tmux), the configurator, and uninstall. Local only: testenv/up.sh, test.sh, shell.sh, down.sh. Not part of CI/CD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
777 B
Python
33 lines
777 B
Python
"""Drive `netssh configure` in huh's accessible mode (TERM=dumb): one answer
|
|
per prompt, sent after a short pause so each form reads its own line."""
|
|
import os
|
|
import pty
|
|
import select
|
|
import sys
|
|
import time
|
|
|
|
answers = sys.argv[1:]
|
|
pid, fd = pty.fork()
|
|
if pid == 0:
|
|
os.execvpe("netssh", ["netssh", "configure"], dict(os.environ, TERM="dumb"))
|
|
out = b""
|
|
|
|
|
|
def drain(seconds):
|
|
global out
|
|
end = time.time() + seconds
|
|
while time.time() < end:
|
|
ready, _, _ = select.select([fd], [], [], 0.05)
|
|
if ready:
|
|
try:
|
|
out += os.read(fd, 4096)
|
|
except OSError:
|
|
return
|
|
|
|
|
|
for answer in answers:
|
|
drain(0.5)
|
|
os.write(fd, (answer + "\n").encode())
|
|
drain(2)
|
|
sys.stdout.write(out.decode(errors="replace"))
|