Adding version for neutronclient

While authenticating with user name and password, the version
has tp be specified in the auth_url as shown here:
http://docs.openstack.org/developer/python-neutronclient/

Making the config option contain the full path, including the
version.

Change-Id: I290b0fbef5bfdfbae7c473f09e2aa676ea3602f9
This commit is contained in:
Mohammad Banikazemi 2015-12-10 00:18:48 -05:00
parent 985692ded2
commit 494fca6578
4 changed files with 7 additions and 5 deletions

View File

@ -49,7 +49,7 @@ neutron_opts = [
keystone_opts = [
cfg.StrOpt('auth_uri',
default=os.environ.get('IDENTITY_URL',
'http://127.0.0.1:35357'),
'http://127.0.0.1:35357/v2.0'),
help=_('The URL for accessing the identity service.')),
cfg.StrOpt('admin_user',
default=os.environ.get('SERVICE_USER'),

View File

@ -53,7 +53,7 @@ def neutron_client():
password=password, auth_url=auth_uri)
else:
app.neutron = utils.get_neutron_client_simple(
url=neutron_uri, token=auth_token)
url=neutron_uri, auth_url=auth_uri, token=auth_token)
app.enable_dhcp = cfg.CONF.neutron_client.enable_dhcp
app.neutron.format = 'json'

View File

@ -35,7 +35,7 @@ class ConfigurationTest(base.TestKuryrBase):
self.assertEqual('http://127.0.0.1:9696',
config.CONF.neutron_client.neutron_uri)
self.assertEqual('http://127.0.0.1:35357',
self.assertEqual('http://127.0.0.1:35357/v2.0',
config.CONF.keystone_client.auth_uri)
def test_check_for_neutron_ext_support_with_ex(self):

View File

@ -29,8 +29,10 @@ DOCKER_NETNS_BASE = '/var/run/docker/netns'
PORT_POSTFIX = 'port'
def get_neutron_client_simple(url, token):
return client.Client('2.0', endpoint_url=url, token=token)
def get_neutron_client_simple(url, auth_url, token):
auths = auth_url.rsplit('/', 1)
version = auths[1][1:]
return client.Client(version, endpoint_url=url, token=token)
def get_neutron_client(url, username, tenant_name, password,