kubernetes: handle situation where the configuration is empty
This change is a follow-up to I5bdd369f6c9a78e5f79a926d8690f285fda94af9 where it missed the case where the configuration could be None. Change-Id: I613cbf82932e14a8048e4dcfbf539fe1d83bf9e3
This commit is contained in:
parent
9757e3f1ce
commit
39ff609835
@ -41,10 +41,11 @@ def get_client(log, context, extra_client_constructor=None):
|
|||||||
token, ca, client, extra_client = None, None, None, None
|
token, ca, client, extra_client = None, None, None, None
|
||||||
try:
|
try:
|
||||||
conf = _get_conf(log, context)
|
conf = _get_conf(log, context)
|
||||||
auth = conf.configuration.api_key.get('authorization')
|
if conf:
|
||||||
if auth:
|
auth = conf.configuration.api_key.get('authorization')
|
||||||
token = auth.split()[-1]
|
if auth:
|
||||||
if conf.configuration.ssl_ca_cert:
|
token = auth.split()[-1]
|
||||||
|
if conf and conf.configuration.ssl_ca_cert:
|
||||||
with open(conf.configuration.ssl_ca_cert) as ca_file:
|
with open(conf.configuration.ssl_ca_cert) as ca_file:
|
||||||
ca = ca_file.read()
|
ca = ca_file.read()
|
||||||
ca = base64.b64encode(ca.encode('utf-8')).decode('utf-8')
|
ca = base64.b64encode(ca.encode('utf-8')).decode('utf-8')
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fix Kubernetes in-cluster configuration loading if no local config
|
||||||
|
is present. The previous release missed a fallback case which has
|
||||||
|
been corrected.
|
Loading…
Reference in New Issue
Block a user