1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

k8s_facts: fix handling of unknown resource types (#47857)

This commit is contained in:
Mariusz Mazur 2018-11-06 14:43:55 +01:00 committed by Martin Krizek
parent c5b303fa52
commit a5c8e952e8
2 changed files with 3 additions and 0 deletions

View file

@ -1,3 +1,4 @@
---
bugfixes:
- k8s_facts now returns a resources key in all situations
- "k8s_facts: fix handling of unknown resource types"

View file

@ -183,6 +183,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,