Skip to content

[o2ims] ProvisioningRequest status helper queries the collection and returns a shape its caller cannot consume #1177

Description

@thc1006

check_o2ims_provisioning_request(name, namespace) in operators/o2ims-operator/controllers/utils.py never uses name:

r = requests.get(
    f"{KUBERNETES_BASE_URL}/apis/o2ims.provisioning.oran.org/v1alpha1/provisioningrequests",
    ...
)

That is the collection endpoint. The API server answers it with a ProvisioningRequestList, but the helper then reads r.json()["status"]["provisioningStatus"] as though it were a single object. ProvisioningRequest is cluster-scoped, so namespace correctly does not appear, but a single object should be fetched from:

/apis/o2ims.provisioning.oran.org/v1alpha1/provisioningrequests/{name}

There is a second mismatch on the 404 branch. The helper stores a bool:

response.update({"pv": creation_status["status"]})

while manager.py reads it as a mapping:

_status["pv"]["status"]

Both survive today because the unit tests register a single object at the collection URL, which is not how the API server behaves, so the mocks conceal the bug rather than exposing it. Fixing this means correcting the URL, agreeing one response shape between helper and caller, and changing the tests to mock a List at the collection URL and an object at the object URL.

Found while reviewing #1170, which changes credential handling on the same call path but not this logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions