k8s: handle `fail_json` API from inventory plugin (#59)

Fixes: https://github.com/ansible-collections/kubernetes.core/issues/57
This commit is contained in:
Abhijeet Kasurde
2021-04-19 11:30:13 +05:30
committed by GitHub
parent acbe46f2ce
commit 4846b38819
4 changed files with 21 additions and 7 deletions

View File

@@ -117,8 +117,11 @@ connections:
import json
from ansible.errors import AnsibleError
from ansible_collections.community.kubernetes.plugins.module_utils.common import K8sAnsibleMixin, HAS_K8S_MODULE_HELPER, k8s_import_exception
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
from ansible_collections.community.kubernetes.plugins.module_utils.common import (
K8sAnsibleMixin, HAS_K8S_MODULE_HELPER, k8s_import_exception
)
from ansible_collections.community.kubernetes.plugins.module_utils.exceptions import K8sInventoryException
try:
from openshift.dynamic.exceptions import DynamicApiError
@@ -137,10 +140,6 @@ def format_dynamic_api_exc(exc):
return '%s Reason: %s' % (exc.status, exc.reason)
class K8sInventoryException(Exception):
pass
class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable, K8sAnsibleMixin):
NAME = 'community.kubernetes.k8s'