Laptop SSH shortcuts prefer the locations' wired networks (NA Ingest's 10.66 address is unreachable)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -44,10 +44,13 @@ def slug(s):
|
||||
def config():
|
||||
with urllib.request.urlopen(HUB + "/api/fleet", timeout=10) as r:
|
||||
machines = json.load(r)["machines"]
|
||||
# The locations' wired networks first (10.1 NA, 10.2 WS, 10.3 AB, 10.4 NW, 10.5 SC); NA Ingest also has a
|
||||
# 10.66 address the laptop cannot reach (2026-10-21), and 10.6 is staff Wi-Fi.
|
||||
site = lambda ip: re.match(r"10\.[1-5]\.", ip) is not None
|
||||
wired = lambda ip: not ip.startswith(("10.6.", "169.254.", "127."))
|
||||
lines, used = ["# Written by tools/fleet.py from %s/api/fleet - every machine that took this laptop's key." % HUB], set()
|
||||
for m in sorted(machines, key=lambda m: m["name"].lower()):
|
||||
ip = next((i for i in m["ips"] if wired(i)), m["ips"][0] if m["ips"] else None)
|
||||
ip = next((i for i in m["ips"] if site(i)), next((i for i in m["ips"] if wired(i)), m["ips"][0] if m["ips"] else None))
|
||||
if not ip:
|
||||
continue
|
||||
alias = slug(m["name"])
|
||||
|
||||
Reference in New Issue
Block a user