Merge "Fix neutron endpoint mangling"

This commit is contained in:
Zuul 2018-11-09 23:50:24 +00:00 committed by Gerrit Code Review
commit 3cf6730a71
4 changed files with 231 additions and 1 deletions

View File

@ -492,7 +492,7 @@ class CloudRegion(object):
region_name=self.region_name,
)
network_endpoint = network_adapter.get_endpoint()
if not network_endpoint.rstrip().rsplit('/')[1] == 'v2.0':
if not network_endpoint.rstrip().rsplit('/')[-1] == 'v2.0':
if not network_endpoint.endswith('/'):
network_endpoint += '/'
network_endpoint = urllib.parse.urljoin(

View File

@ -0,0 +1,211 @@
{
"token": {
"audit_ids": [
"Rvn7eHkiSeOwucBIPaKdYA"
],
"catalog": [
{
"endpoints": [
{
"id": "32466f357f3545248c47471ca51b0d3a",
"interface": "public",
"region": "RegionOne",
"url": "https://compute.example.com/v2.1/"
}
],
"name": "nova",
"type": "compute"
},
{
"endpoints": [
{
"id": "1e875ca2225b408bbf3520a1b8e1a537",
"interface": "public",
"region": "RegionOne",
"url": "https://volume.example.com/v2/1c36b64c840a42cd9e9b931a369337f0"
}
],
"name": "cinderv2",
"type": "volumev2"
},
{
"endpoints": [
{
"id": "5a64de3c4a614d8d8f8d1ba3dee5f45f",
"interface": "public",
"region": "RegionOne",
"url": "https://image.example.com"
}
],
"name": "glance",
"type": "image"
},
{
"endpoints": [
{
"id": "3d15fdfc7d424f3c8923324417e1a3d1",
"interface": "public",
"region": "RegionOne",
"url": "https://volume.example.com/v1/1c36b64c840a42cd9e9b931a369337f0"
}
],
"name": "cinder",
"type": "volume"
},
{
"endpoints": [
{
"id": "4deb4d0504a044a395d4480741ba628c",
"interface": "public",
"region": "RegionOne",
"url": "https://identity.example.com"
},
{
"id": "012322eeedcd459edabb4933021112bc",
"interface": "admin",
"region": "RegionOne",
"url": "https://identity.example.com"
}
],
"endpoints_links": [],
"name": "keystone",
"type": "identity"
},
{
"endpoints": [
{
"id": "4deb4d0504a044a395d4480741ba628d",
"interface": "public",
"region": "RegionOne",
"url": "https://network.example.com/v2.0"
}
],
"endpoints_links": [],
"name": "neutron",
"type": "network"
},
{
"endpoints": [
{
"id": "4deb4d0504a044a395d4480741ba628e",
"interface": "public",
"region": "RegionOne",
"url": "https://container-infra.example.com/v1"
}
],
"endpoints_links": [],
"name": "magnum",
"type": "container-infra"
},
{
"endpoints": [
{
"id": "4deb4d0504a044a395d4480741ba628c",
"interface": "public",
"region": "RegionOne",
"url": "https://object-store.example.com/v1/1c36b64c840a42cd9e9b931a369337f0"
}
],
"endpoints_links": [],
"name": "swift",
"type": "object-store"
},
{
"endpoints": [
{
"id": "652f0612744042bfbb8a8bb2c777a16d",
"interface": "public",
"region": "RegionOne",
"url": "https://bare-metal.example.com/"
}
],
"endpoints_links": [],
"name": "ironic",
"type": "baremetal"
},
{
"endpoints": [
{
"id": "4deb4d0504a044a395d4480741ba628c",
"interface": "public",
"region": "RegionOne",
"url": "https://orchestration.example.com/v1/1c36b64c840a42cd9e9b931a369337f0"
}
],
"endpoints_links": [],
"name": "heat",
"type": "orchestration"
},
{
"endpoints": [
{
"id": "10c76ffd2b744a67950ed1365190d353",
"interface": "public",
"region": "RegionOne",
"url": "https://placement.example.com"
}
],
"endpoints_links": [],
"name": "placement",
"type": "placement"
},
{
"endpoints": [
{
"id": "10c76ffd2b744a67950ed1365190d352",
"interface": "public",
"region": "RegionOne",
"url": "https://dns.example.com"
}
],
"endpoints_links": [],
"name": "designate",
"type": "dns"
},
{
"endpoints": [
{
"id": "4deb4d0504a044a395d4480741ba624z",
"interface": "public",
"region": "RegionOne",
"url": "https://clustering.example.com"
}
],
"endpoints_links": [],
"name": "senlin",
"type": "clustering"
}
],
"expires_at": "9999-12-31T23:59:59Z",
"issued_at": "2016-12-17T14:25:05.000000Z",
"methods": [
"password"
],
"project": {
"domain": {
"id": "default",
"name": "default"
},
"id": "1c36b64c840a42cd9e9b931a369337f0",
"name": "Default Project"
},
"roles": [
{
"id": "9fe2ff9ee4384b1894a90878d3e92bab",
"name": "_member_"
},
{
"id": "37071fc082e14c2284c32a2761f71c63",
"name": "swiftoperator"
}
],
"user": {
"domain": {
"id": "default",
"name": "default"
},
"id": "c17534835f8f42bf98fc367e0bf35e09",
"name": "mordred"
}
}
}

View File

@ -229,6 +229,20 @@ class TestConnection(base.TestCase):
class TestNetworkConnection(base.TestCase):
# Verify that if the catalog has the suffix we don't mess things up.
def test_network_proxy(self):
self.use_keystone_v3(catalog='catalog-v3-suffix.json')
self.assertEqual(
'openstack.network.v2._proxy',
self.conn.network.__class__.__module__)
self.assert_calls()
self.assertEqual(
"https://network.example.com/v2.0",
self.conn.network.get_endpoint())
class TestNetworkConnectionSuffix(base.TestCase):
# We need to do the neutron adapter test differently because it needs
# to actually get a catalog.

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixed incorrect neutron endpoint mangling for the cases when the catalog
contains a versioned neutron endpoint.