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
k8s_facts: fix handling of unknown resource types #47857
Conversation
Hi @mmazur, thank you for submitting this pull-request! |
This is great, thanks @mmazur! |
candidate for 2.7 backport |
Because this is a candidate for a 2.7 backport, and all backports need a changelog fragment, could you add one please (or just update the existing https://github.com/ansible/ansible/blob/devel/changelogs/fragments/k8s_facts_fix.yaml) |
@willthames you mean I should update this PR with a change to changelogs/fragments/k8s_facts_fix.yaml adding a oneliner for my change, right? |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The test
|
The test
|
shipit |
rebuild_merge |
(cherry picked from commit a5c8e95)
(cherry picked from commit a5c8e95)
SUMMARY
k8s_facts can be asked about resource kind/apiver combinations that it knows nothing about. This patch makes the code handle such a case gracefully.
ISSUE TYPE
COMPONENT NAME
modules/clustering/k8s/k8s_facts
ANSIBLE VERSION
ADDITIONAL INFORMATION
A full trace of what happens when running k8s_facts with a non–existant kind/apiver combo, in which case K8sAnsibleMixin.find_resource returns None while called from kubernetes_facts() function: