k8s_info - fix issue with kubernetes-client caching when api-server was available (#571)

k8s_info - fix issue with kubernetes-client caching when api-server was available

SUMMARY
closes #508
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

k8s_info
ADDITIONAL INFORMATION

Reviewed-by: Mike Graves <mgraves@redhat.com>
This commit is contained in:
Bikouo Aubin
2023-01-24 11:43:30 +01:00
committed by GitHub
parent af7c24cba7
commit 8ed4d4b6ed
7 changed files with 347 additions and 242 deletions

View File

@@ -23,7 +23,6 @@ from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions imp
)
from ansible.module_utils.common.dict_transformations import dict_merge
from ansible.module_utils._text import to_native
try:
from kubernetes.dynamic.exceptions import (
@@ -268,8 +267,13 @@ class K8sService:
except BadRequestError:
return result
except CoreException as e:
result["msg"] = to_native(e)
return result
raise e
except Exception as e:
raise CoreException(
"Exception '{0}' raised while trying to get resource using (name={1}, namespace={2}, label_selectors={3}, field_selectors={4})".format(
e, name, namespace, label_selectors, field_selectors
)
)
# There is either no result or there is a List resource with no items
if (