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:
parent
fba30fe8b4
commit
41ca33d8fd
1 changed files with 10 additions and 3 deletions
|
|
@ -133,10 +133,17 @@ class OnyxClient:
|
||||||
# -- idempotent connector provisioning -----------------------------------
|
# -- idempotent connector provisioning -----------------------------------
|
||||||
def find_cc_pair_id_by_name(self, name: str) -> int | None:
|
def find_cc_pair_id_by_name(self, name: str) -> int | None:
|
||||||
"""Look up an existing connector/credential pair by name so provisioning is
|
"""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(
|
resp = self._request(
|
||||||
"POST", "/manage/admin/connector/indexing-status",
|
"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:
|
if resp.status_code >= 400:
|
||||||
return None
|
return None
|
||||||
|
|
@ -237,4 +244,4 @@ class OnyxClient:
|
||||||
def _admin_auth(self) -> tuple[str, str] | None:
|
def _admin_auth(self) -> tuple[str, str] | None:
|
||||||
if self._admin_email and self._admin_password:
|
if self._admin_email and self._admin_password:
|
||||||
return (self._admin_email, self._admin_password)
|
return (self._admin_email, self._admin_password)
|
||||||
return None
|
return None
|
||||||
Loading…
Add table
Reference in a new issue