Merge "Always pass keystone credentials to neutronclient"

This commit is contained in:
Jenkins 2015-12-10 19:35:38 +00:00 committed by Gerrit Code Review
commit 767cac11f8
2 changed files with 7 additions and 6 deletions

View File

@ -77,8 +77,7 @@ def _build_client(token=None):
if CONF.neutron.auth_strategy == 'noauth':
params['endpoint_url'] = CONF.neutron.url
params['auth_strategy'] = 'noauth'
elif (CONF.neutron.auth_strategy == 'keystone' and
token is None):
else:
params['endpoint_url'] = (CONF.neutron.url or
keystone.get_service_url('neutron'))
params['username'] = CONF.keystone_authtoken.admin_user
@ -87,10 +86,7 @@ def _build_client(token=None):
params['auth_url'] = (CONF.keystone_authtoken.auth_uri or '')
if CONF.keystone.region_name:
params['region_name'] = CONF.keystone.region_name
else:
params['token'] = token
params['endpoint_url'] = CONF.neutron.url
params['auth_strategy'] = None
return clientv20.Client(**params)

View File

@ -79,7 +79,10 @@ class TestNeutron(db_base.DbTestCase):
'ca_cert': 'test-file',
'token': token,
'endpoint_url': 'test-url',
'auth_strategy': None}
'username': 'test-admin-user',
'tenant_name': 'test-admin-tenant',
'password': 'test-admin-password',
'auth_url': 'test-auth-uri'}
mock_client_init.return_value = None
neutron._build_client(token=token)
@ -91,6 +94,7 @@ class TestNeutron(db_base.DbTestCase):
'retries': 2,
'insecure': False,
'ca_cert': 'test-file',
'token': None,
'endpoint_url': 'test-url',
'username': 'test-admin-user',
'tenant_name': 'test-admin-tenant',
@ -107,6 +111,7 @@ class TestNeutron(db_base.DbTestCase):
'retries': 2,
'insecure': False,
'ca_cert': 'test-file',
'token': None,
'endpoint_url': 'test-url',
'username': 'test-admin-user',
'tenant_name': 'test-admin-tenant',