Skip to content

Flatten API exceptions in aio create_from_yaml failures - #2828

Open
r4victor wants to merge 1 commit into
kubernetes-client:masterfrom
r4victor:fix-aio-fail-to-create-error
Open

r4victor wants to merge 1 commit into
kubernetes-client:masterfrom
r4victor:fix-aio-fail-to-create-error

Conversation

@r4victor

@r4victor r4victor commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Make aio create_from_yaml collect the API exceptions from each failed document instead of nesting FailToCreateErrors, matching the sync version, so FailToCreateError can be formatted and api_exceptions holds ApiExceptions.

Which issue(s) this PR fixes:

Fixes #2827

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fixed `FailToCreateError` raised by `kubernetes.aio.utils.create_from_yaml` failing to format with `AttributeError`; its `api_exceptions` now contains the API exceptions.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 2, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from roycaihw December 2, 2026 10:55
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: r4victor
Once this PR has been reviewed and has the lgtm label, please assign roycaihw for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot requested a review from yliaog December 2, 2026 10:55
@kubernetes-prow kubernetes-prow Bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. release-note-none Denotes a PR that doesn't merit a release note. labels Dec 2, 2026

@suirindo suirindo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add an async multi-document test with two failing objects that checks both api_exceptions and str(error)? With synthetic per-document failures, the patched function keeps both API errors and renders both reasons. Restoring append(failure) makes string formatting raise AttributeError instead. This is a regression-test suggestion, not a new defect; no cluster was contacted. AI-assisted review.

@r4victor

r4victor commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

@suirindo, intentionally left out regression tests to avoid tests blow up. The type checker will catch such errors once it's integrated in the CI.

@roycaihw

roycaihw commented Dec 3, 2026

Copy link
Copy Markdown
Member

/assign @yliaog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aio create_from_yaml nests FailToCreateError leading to AttributeError when formatting the error

4 participants