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

(cherry picked from commit 0421305254)
pull/43346/head
Fabian von Feilitzsch 6 years ago committed by Matt Clay
parent 18ef94d56c
commit 134ed24474

@ -138,8 +138,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)

Loading…
Cancel
Save