Kubernetes 'ssl_ca_cert' value error
When tacker registers kubernetes vim using Kubernetes config file, ssl_ca_cert value doesn't accept all of none value such as none, NONE..etc. So, it makes errors. Closes-Bug: #1829384 Change-Id: I1aa2c4c489a3196fa8f88c1ca8420e8b344d875b
This commit is contained in:
parent
1fe295ca88
commit
881fd99256
@ -158,7 +158,7 @@ support multi tenant on Kubernetes in the future.
|
||||
|
||||
auth_url: "https://192.168.11.110:6443"
|
||||
bearer_token: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImRlZmF1bHQtdG9rZW4tc2ZqcTQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGVmYXVsdCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjBiMzZmYTQ2LWFhOTUtMTFlNy05M2Q4LTQwOGQ1Y2Q0ZmJmMSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZWZhdWx0OmRlZmF1bHQifQ.MBjFA18AjD6GyXmlqsdsFpJD_tgPfst2faOimfVob-gBqnAkAU0Op2IEauiBVooFgtvzm-HY2ceArftSlZQQhLDrJGgH0yMAUmYhI8pKcFGd_hxn_Ubk7lPqwR6GIuApkGVMNIlGh7LFLoF23S_yMGvO8CHPM-UbFjpbCOECFdnoHjz-MsMqyoMfGEIF9ga7ZobWcKt_0A4ge22htL2-lCizDvjSFlAj4cID2EM3pnJ1J3GXEqu-W9DUFa0LM9u8fm_AD9hBKVz1dePX1NOWglxxjW4KGJJ8dV9_WEmG2A2B-9Jy6AKW83qqicBjYUUeAKQfjgrTDl6vSJOHYyzCYQ"
|
||||
ssl_ca_cert: None
|
||||
ssl_ca_cert: 'None'
|
||||
project_name: "default"
|
||||
type: "kubernetes"
|
||||
|
||||
|
@ -225,3 +225,11 @@ def get_auth_url_v3(auth_url):
|
||||
return auth_url
|
||||
else:
|
||||
return '{0}/v3'.format(auth_url)
|
||||
|
||||
|
||||
def _none_from_string(myStr):
|
||||
none_values = ['', 'None', 'NONE', 'null', 'NULL', [], {}]
|
||||
if myStr in none_values:
|
||||
return None
|
||||
else:
|
||||
return myStr
|
||||
|
@ -19,6 +19,7 @@ from oslo_log import log as logging
|
||||
from tacker._i18n import _
|
||||
from tacker.common.container import kubernetes_utils
|
||||
from tacker.common import log
|
||||
from tacker.common import utils
|
||||
from tacker import context as t_context
|
||||
from tacker.extensions import nfvo
|
||||
from tacker.keymgr import API as KEYMGR_API
|
||||
@ -75,8 +76,8 @@ class Kubernetes_Driver(abstract_vim_driver.VimAbstractDriver):
|
||||
return auth_cred, file_descriptor
|
||||
|
||||
def _create_ssl_ca_file(self, auth_cred):
|
||||
if auth_cred.get('ssl_ca_cert', ''):
|
||||
ca_cert = auth_cred['ssl_ca_cert']
|
||||
ca_cert = utils._none_from_string(auth_cred.get('ssl_ca_cert'))
|
||||
if ca_cert:
|
||||
file_descriptor, file_path = \
|
||||
self.kubernetes.create_ca_cert_tmp_file(ca_cert)
|
||||
auth_cred['ca_cert_file'] = file_path
|
||||
@ -192,7 +193,7 @@ class Kubernetes_Driver(abstract_vim_driver.VimAbstractDriver):
|
||||
encoded_auth = fernet_obj.encrypt(
|
||||
auth['bearer_token'].encode('utf-8'))
|
||||
auth['bearer_token'] = encoded_auth
|
||||
if auth.get('ssl_ca_cert', ''):
|
||||
if utils._none_from_string(auth.get('ssl_ca_cert')):
|
||||
encoded_auth = fernet_obj.encrypt(
|
||||
auth['ssl_ca_cert'].encode('utf-8'))
|
||||
auth['ssl_ca_cert'] = encoded_auth
|
||||
|
Loading…
x
Reference in New Issue
Block a user