Skip to content

[Bug] create_org may not work due to limited return size. #459

Open
@csanders-git

Description

@csanders-git

Description

create_org() calls _get_guid_by_id() with id_key="orgUid". This triggers the following code:

 if id_key != "orgId":
            guid = ""
            page = self.get_page()
            for org in page["orgs"]:
                if org[id_key] == org_id:
                    return org["orgGuid"]
            if not guid:
                raise Py42Error(f"Couldn't find an Org with ID '{org_id}'.")

This code calls self.get_page() which will only return the first 500. If the uid being searched for is not in the first 500 this will return an error even if the org exists. In our example org this included the parent org ID.

Steps to Reproduce

  1. Have an org with over 500 orgs
  2. Create an org with the parent of one of those not returned in the first 500
  3. An error will occur

Expected Behavior

Org will be created

Actual Behavior

Py42Error is thrown

Basic Information

  • py42 version: 1.26.1
  • python version: 3.11.4
  • operating system: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions