k8s_facts: fix handling of unknown resource types (#47857)
(cherry picked from commit a5c8e952e8
)
This commit is contained in:
parent
84db20ea07
commit
642cd53857
2 changed files with 3 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
bugfixes:
|
||||
- k8s_facts now returns a resources key in all situations
|
||||
- "k8s_facts: fix handling of unknown resource types"
|
||||
|
|
|
@ -198,6 +198,8 @@ class K8sAnsibleMixin(object):
|
|||
|
||||
def kubernetes_facts(self, kind, api_version, name=None, namespace=None, label_selectors=None, field_selectors=None):
|
||||
resource = self.find_resource(kind, api_version)
|
||||
if not resource:
|
||||
return dict(resources=[])
|
||||
try:
|
||||
result = resource.get(name=name,
|
||||
namespace=namespace,
|
||||
|
|
Loading…
Reference in a new issue