Campus hello: the same address under a new name replaces its old entry
Woonsocket reported as "new" before its first setup finished, then as ws: NA kept both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -890,7 +890,10 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
or not allowed_client(url[7:].split(":")[0]):
|
||||
return self.send(400, {"error": "an id like ws and an address like http://10.5.1.1:8020"})
|
||||
data = campuses.load(site.data_dir)
|
||||
data.setdefault("list", {})[cid] = {"id": cid, "name": str(body.get("name") or cid)[:40], "url": url}
|
||||
lst = data.setdefault("list", {})
|
||||
for other in [k for k, e in lst.items() if k != cid and (e or {}).get("url") == url]:
|
||||
lst.pop(other) # the same Mac under its old name (before its first setup)
|
||||
lst[cid] = {"id": cid, "name": str(body.get("name") or cid)[:40], "url": url}
|
||||
campuses.save(site.data_dir, data)
|
||||
return self.send(200, {"ok": True})
|
||||
if path == "/api/fleet/hello":
|
||||
|
||||
Reference in New Issue
Block a user