Do not have to mention ssl_ca_cert in vim config file (client)
Current tacker client requires us to mention ssl_ca_cert and set it to None if we don't want to use ssl cert. This patch along with another patch on the tacker server side will make ssl_ca_cert a truly optional config. And, only the correct ssl_ca_cert will be able to authenticate. Tacker Server changes: https://review.openstack.org/#/c/546580/ Change-Id: Ic87fe3382e100183c685c3b34768a5a5de889982
This commit is contained in:
@@ -74,16 +74,9 @@ def args2body_vim(config_param, vim):
|
|||||||
message='username and password or bearer_token must be'
|
message='username and password or bearer_token must be'
|
||||||
'provided',
|
'provided',
|
||||||
status_code=404)
|
status_code=404)
|
||||||
if 'ssl_ca_cert' in config_param:
|
ssl_ca_cert = config_param.pop('ssl_ca_cert', '')
|
||||||
ssl_ca_cert = config_param.pop('ssl_ca_cert', '')
|
if ssl_ca_cert:
|
||||||
if ssl_ca_cert == 'None':
|
vim['auth_cred']['ssl_ca_cert'] = ssl_ca_cert
|
||||||
vim['auth_cred']['ssl_ca_cert'] = None
|
|
||||||
else:
|
|
||||||
vim['auth_cred']['ssl_ca_cert'] = ssl_ca_cert
|
|
||||||
else:
|
|
||||||
raise exceptions.TackerClientException(
|
|
||||||
message='ssl_ca_cert must be provided or leave it with None',
|
|
||||||
status_code=404)
|
|
||||||
|
|
||||||
|
|
||||||
def validate_auth_url(url):
|
def validate_auth_url(url):
|
||||||
|
@@ -35,7 +35,7 @@ class CLITestV10VIMJSON(test_cli10.CLITestV10Base):
|
|||||||
plurals = {'vims': 'vim'}
|
plurals = {'vims': 'vim'}
|
||||||
super(CLITestV10VIMJSON, self).setUp(plurals=plurals)
|
super(CLITestV10VIMJSON, self).setUp(plurals=plurals)
|
||||||
self.vim_project = {'name': 'default'}
|
self.vim_project = {'name': 'default'}
|
||||||
self.auth_cred = {'bearer_token': 'xyz', 'ssl_ca_cert': None}
|
self.auth_cred = {'bearer_token': 'xyz', 'ssl_ca_cert': "None"}
|
||||||
self.auth_url = 'https://1.2.3.4:6443'
|
self.auth_url = 'https://1.2.3.4:6443'
|
||||||
self.type = 'kubernetes'
|
self.type = 'kubernetes'
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ class TestVIMUtils(testtools.TestCase):
|
|||||||
|
|
||||||
def test_args2body_kubernetes_vim_bearer(self):
|
def test_args2body_kubernetes_vim_bearer(self):
|
||||||
config_param = {'bearer_token': sentinel.bearer_token,
|
config_param = {'bearer_token': sentinel.bearer_token,
|
||||||
'ssl_ca_cert': None,
|
'ssl_ca_cert': "None",
|
||||||
'project_name': sentinel.prj_name,
|
'project_name': sentinel.prj_name,
|
||||||
'type': 'kubernetes'}
|
'type': 'kubernetes'}
|
||||||
vim = {}
|
vim = {}
|
||||||
|
3
tox.ini
3
tox.ini
@@ -37,3 +37,6 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
|
|||||||
ignore = E125
|
ignore = E125
|
||||||
show-source = true
|
show-source = true
|
||||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools
|
||||||
|
# F821 undefined name 'unicode'
|
||||||
|
# if isinstance(config, str) or isinstance(config, unicode):
|
||||||
|
builtins = unicode
|
||||||
|
Reference in New Issue
Block a user