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:
parent
c5b303fa52
commit
a5c8e952e8
2 changed files with 3 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
||||||
---
|
---
|
||||||
bugfixes:
|
bugfixes:
|
||||||
- k8s_facts now returns a resources key in all situations
|
- k8s_facts now returns a resources key in all situations
|
||||||
|
- "k8s_facts: fix handling of unknown resource types"
|
||||||
|
|
|
@ -183,6 +183,8 @@ class K8sAnsibleMixin(object):
|
||||||
|
|
||||||
def kubernetes_facts(self, kind, api_version, name=None, namespace=None, label_selectors=None, field_selectors=None):
|
def kubernetes_facts(self, kind, api_version, name=None, namespace=None, label_selectors=None, field_selectors=None):
|
||||||
resource = self.find_resource(kind, api_version)
|
resource = self.find_resource(kind, api_version)
|
||||||
|
if not resource:
|
||||||
|
return dict(resources=[])
|
||||||
try:
|
try:
|
||||||
result = resource.get(name=name,
|
result = resource.get(name=name,
|
||||||
namespace=namespace,
|
namespace=namespace,
|
||||||
|
|
Loading…
Reference in a new issue