feat(harfanglab): instance-level tenant scope (1.8.0)
An instance can carry the tenant of the client it serves, for clients sharing one multi-tenant manager. endpoint_count uses it, for the count and the fleet total beside it, when the block leaves its tenant filter empty; a tenant named on the block still wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TgjV26rz6VcP262dX4vBrD
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -86,7 +86,13 @@ def main():
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
}
|
}
|
||||||
# === per-command logic ===
|
# === per-command logic ===
|
||||||
filters = {}
|
# An instance bound to one tenant of a shared, multi-tenant manager carries it
|
||||||
|
# in its config: it scopes the count, and the fleet total beside it, unless the
|
||||||
|
# block names a tenant itself.
|
||||||
|
scope = {}
|
||||||
|
if not str(inputs.get("tenant") or "").strip() and str(secrets.get("tenant") or "").strip():
|
||||||
|
scope["tenant"] = str(secrets["tenant"]).strip()
|
||||||
|
filters = dict(scope)
|
||||||
for field in EXACT_FILTERS:
|
for field in EXACT_FILTERS:
|
||||||
value = inputs.get(field)
|
value = inputs.get(field)
|
||||||
if value is None or value == "":
|
if value is None or value == "":
|
||||||
@@ -112,8 +118,8 @@ def main():
|
|||||||
# The API silently drops a query parameter it does not recognise as a
|
# The API silently drops a query parameter it does not recognise as a
|
||||||
# filter, which yields the unfiltered total dressed up as a filtered count.
|
# filter, which yields the unfiltered total dressed up as a filtered count.
|
||||||
# Returning the fleet total alongside makes that failure visible.
|
# Returning the fleet total alongside makes that failure visible.
|
||||||
if filters:
|
if filters != scope:
|
||||||
everything = request("GET", agents + qs({"limit": 1, "offset": 0}), headers)
|
everything = request("GET", agents + qs(dict(scope, limit=1, offset=0)), headers)
|
||||||
result["total"] = everything.get("count", 0)
|
result["total"] = everything.get("count", 0)
|
||||||
else:
|
else:
|
||||||
result["total"] = result["count"]
|
result["total"] = result["count"]
|
||||||
|
|||||||
Reference in New Issue
Block a user