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

Properly format API key when set in an enviroment variable (#42202)

This commit is contained in:
Fabian von Feilitzsch 2018-07-13 16:31:22 -04:00 committed by ansibot
parent 4f63134d78
commit 0421305254

View file

@ -148,8 +148,11 @@ class K8sAnsibleMixin(object):
elif key in auth_args and value is None: elif key in auth_args and value is None:
env_value = os.getenv('K8S_AUTH_{0}'.format(key.upper()), None) env_value = os.getenv('K8S_AUTH_{0}'.format(key.upper()), None)
if env_value is not None: if env_value is not None:
setattr(configuration, key, env_value) if key == 'api_key':
auth[key] = env_value setattr(configuration, key, {'authorization': "Bearer {0}".format(env_value)})
else:
setattr(configuration, key, env_value)
auth[key] = env_value
kubernetes.client.Configuration.set_default(configuration) kubernetes.client.Configuration.set_default(configuration)