Skip to content

Pagination never terminates for oci.tenant_manager_control_plane.OrganizationClient.list_organizations in Python SDK #718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
davide-maestroni opened this issue Nov 6, 2024 · 6 comments

Comments

@davide-maestroni
Copy link

It looks like pagination is broken for oci.tenant_manager_control_plane.OrganizationClient.list_organizations, each call returns a response object with a different next_page token and has_next_page set to True, but the items in the data are always the same.

To reproduce just run:

organization_client = oci.tenant_manager_control_plane.OrganizationClient(config)
for response in oci.pagination.list_call_get_all_results_generator(
organization_client.list_organizations, "response", tenancy_ocid
):
print(response.data.items)
print(response.next_page)
print(response.has_next_page)

@adizohar
Copy link
Member

adizohar commented Nov 7, 2024

Hi, Did you try the below ?

organization_client = oci.tenant_manager_control_plane.OrganizationClient(config)
result = oci.pagination.list_call_get_all_results(organization_client.list_organizations, tenant_id)
print(result.data)

@davide-maestroni
Copy link
Author

Yes, I was initially doing that, but the call to oci.pagination.list_call_get_all_results never exited.
After some debugging I realized that the pagination mechanism was broken.

@adizohar
Copy link
Member

adizohar commented Nov 7, 2024

Hi Davide, how many organizations do you have in order to check the pagination ?

@davide-maestroni
Copy link
Author

In my testing setup there is just one Tenancy and one Organization.

@adizohar
Copy link
Member

adizohar commented Nov 7, 2024

Without pagination you will be able to extract all the organizations that allowed
I don't see any issue here, once you have 100+ organizations and work with the pagination API, let us know if any issue

@davide-maestroni
Copy link
Author

@adizohar, now the pagination is behaving correctly. I guess something has been fixed on the backend side.
This is exactly what I was hoping for.
Thank you for the support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants