Fix connector lookup on Onyx 5.0 (paginated indexing-status)

Onyx 5.0 paginated /admin/connector/indexing-status to 10 connectors per
source per page (default page 1). find_cc_pair_id_by_name read only the
first page, so with >10 connectors in a source it missed the existing
AIDO SMB connector and provisioning then failed with
"Connector by this name already exists, duplicate naming not allowed."

Request every connector via the new get_all_connectors flag so the
lookup is reliable regardless of connector count. Verified against the
v5.0 source and a live v5.0 instance.
This commit is contained in:
Jannic Debus 2026-11-16 15:20:27 +01:00
parent fba30fe8b4
commit 41ca33d8fd

View file

@ -133,10 +133,17 @@ class OnyxClient:
# -- idempotent connector provisioning -----------------------------------
def find_cc_pair_id_by_name(self, name: str) -> int | None:
"""Look up an existing connector/credential pair by name so provisioning is
idempotent even if the local state (cached id) was lost."""
idempotent even if the local state (cached id) was lost.
Onyx 5.0 paginates this endpoint (10 connectors per source per page) and
defaults to page 1, so without ``get_all_connectors`` a connector beyond
the first page is invisible — the lookup would miss it and provisioning
would then fail with "duplicate naming not allowed". Request every
connector so the match is reliable regardless of how many exist."""
resp = self._request(
"POST", "/manage/admin/connector/indexing-status",
json={"secondary_index": False}, auth=self._admin_auth,
json={"secondary_index": False, "get_all_connectors": True},
auth=self._admin_auth,
)
if resp.status_code >= 400:
return None