mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-06 13:02:37 +00:00
k8s: fix get_api_client usage in inventory plugin (#395)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
2
changelogs/fragments/k8s_inventory.yml
Normal file
2
changelogs/fragments/k8s_inventory.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- k8s - fix get_api_client API in k8s inventory plugin (https://github.com/ansible-collections/community.kubernetes/pull/395).
|
||||
@@ -23,7 +23,7 @@ DOCUMENTATION = '''
|
||||
plugin:
|
||||
description: token that ensures this is a source file for the 'k8s' plugin.
|
||||
required: True
|
||||
choices: ['k8s']
|
||||
choices: ['community.kubernetes.k8s', 'k8s']
|
||||
connections:
|
||||
description:
|
||||
- Optional list of cluster connection settings. If no connections are provided, the default
|
||||
|
||||
@@ -118,7 +118,7 @@ def configuration_digest(configuration):
|
||||
return digest
|
||||
|
||||
|
||||
def get_api_client(module=None):
|
||||
def get_api_client(module=None, **kwargs):
|
||||
auth = {}
|
||||
|
||||
def _raise_or_fail(exc, msg):
|
||||
@@ -131,6 +131,8 @@ def get_api_client(module=None):
|
||||
for true_name, arg_name in AUTH_ARG_MAP.items():
|
||||
if module and module.params.get(arg_name):
|
||||
auth[true_name] = module.params.get(arg_name)
|
||||
elif arg_name in kwargs and kwargs.get(arg_name) is not None:
|
||||
auth[true_name] = kwargs.get(arg_name)
|
||||
else:
|
||||
env_value = os.getenv('K8S_AUTH_{0}'.format(arg_name.upper()), None) or os.getenv('K8S_AUTH_{0}'.format(true_name.upper()), None)
|
||||
if env_value is not None:
|
||||
|
||||
Reference in New Issue
Block a user