Using the credentials from the config file.

Change-Id: I9d0bb6ead24ce414fb7187b7135d182cfe2d0262
This commit is contained in:
Mohammad Banikazemi 2016-09-19 13:56:59 -04:00 committed by Antoni Segura Puimedon
parent 7963217f7b
commit 5a62a48bb9
2 changed files with 3 additions and 12 deletions

View File

@ -59,23 +59,14 @@ def _get_cloud_config_auth_data(cloud='devstack-admin'):
return cloud_config.get_auth(), cloud_config.get_session()
def _get_neutron_client_from_creds():
def get_neutron_client_from_creds():
auth_plugin, session = _get_cloud_config_auth_data()
return client.Client(session=session, auth=auth_plugin)
def get_neutron_client():
"""Creates the Neutron client for communicating with Neutron."""
try:
# First try to retrieve neutron client from a working OS deployment
# This is used for gate testing.
# Since this always use admin credentials, next patch will introduce
# a config parameter that disable this for production environments
neutron_client = _get_neutron_client_from_creds()
except Exception:
neutron_client = lib_utils.get_neutron_client()
return neutron_client
return lib_utils.get_neutron_client()
def neutron_client():

View File

@ -28,4 +28,4 @@ class KuryrBaseTest(base.BaseTestCase):
super(KuryrBaseTest, self).setUp()
self.docker_client = docker.Client(
base_url='tcp://0.0.0.0:2375')
self.neutron_client = controllers.get_neutron_client()
self.neutron_client = controllers.get_neutron_client_from_creds()