Remove workaround for bug #1709118
A possible fix [1] for bug #1709118 is in keystoneauth1 release 3.3.0. This change removes a workaround for that bug in nova.utils.get_endpoint. [1] https://review.openstack.org/#/c/500956/ Change-Id: If2a56ed56ecb3402fdee1189df81f0b9fbc483b3 Related-Bug: #1709118
This commit is contained in:
parent
2c6542948f
commit
5601c82915
|
@ -21,7 +21,6 @@ import tempfile
|
||||||
import eventlet
|
import eventlet
|
||||||
import fixtures
|
import fixtures
|
||||||
from keystoneauth1 import adapter as ks_adapter
|
from keystoneauth1 import adapter as ks_adapter
|
||||||
from keystoneauth1 import exceptions as ks_exc
|
|
||||||
from keystoneauth1.identity import base as ks_identity
|
from keystoneauth1.identity import base as ks_identity
|
||||||
from keystoneauth1 import session as ks_session
|
from keystoneauth1 import session as ks_session
|
||||||
import mock
|
import mock
|
||||||
|
@ -1055,21 +1054,6 @@ class GetEndpointTestCase(test.NoDBTestCase):
|
||||||
self.adap.get_endpoint_data.assert_not_called()
|
self.adap.get_endpoint_data.assert_not_called()
|
||||||
self.adap.get_endpoint.assert_called_once_with()
|
self.adap.get_endpoint.assert_called_once_with()
|
||||||
|
|
||||||
def test_nonimage_try_interfaces(self):
|
|
||||||
self.adap.get_endpoint.side_effect = (ks_exc.EndpointNotFound, 'url')
|
|
||||||
self.assertEqual('url', utils.get_endpoint(self.adap))
|
|
||||||
self.adap.get_endpoint_data.assert_not_called()
|
|
||||||
self.assertEqual(2, self.adap.get_endpoint.call_count)
|
|
||||||
self.assertEqual('admin', self.adap.interface)
|
|
||||||
|
|
||||||
def test_nonimage_try_interfaces_fail(self):
|
|
||||||
self.adap.get_endpoint.side_effect = ks_exc.EndpointNotFound
|
|
||||||
self.assertRaises(ks_exc.EndpointNotFound,
|
|
||||||
utils.get_endpoint, self.adap)
|
|
||||||
self.adap.get_endpoint_data.assert_not_called()
|
|
||||||
self.assertEqual(3, self.adap.get_endpoint.call_count)
|
|
||||||
self.assertEqual('public', self.adap.interface)
|
|
||||||
|
|
||||||
|
|
||||||
class RunOnceTests(test.NoDBTestCase):
|
class RunOnceTests(test.NoDBTestCase):
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from keystoneauth1 import exceptions as ks_exc
|
|
||||||
from keystoneauth1 import loading as ks_loading
|
from keystoneauth1 import loading as ks_loading
|
||||||
import netaddr
|
import netaddr
|
||||||
from openstack import connection
|
from openstack import connection
|
||||||
|
@ -1066,30 +1065,7 @@ def get_endpoint(ksa_adapter):
|
||||||
# ksa_adapter.auth is a _ContextAuthPlugin, which doesn't have
|
# ksa_adapter.auth is a _ContextAuthPlugin, which doesn't have
|
||||||
# get_endpoint_data. Fall through to using get_endpoint().
|
# get_endpoint_data. Fall through to using get_endpoint().
|
||||||
pass
|
pass
|
||||||
# TODO(efried): The remainder of this method reduces to
|
|
||||||
# TODO(efried): return ksa_adapter.get_endpoint()
|
|
||||||
# TODO(efried): once bug #1709118 is fixed.
|
|
||||||
# NOTE(efried): Id9bd19cca68206fc64d23b0eaa95aa3e5b01b676 may also do the
|
|
||||||
# trick, once it's in a ksa release.
|
|
||||||
# The EndpointNotFound exception happens when _ContextAuthPlugin is in play
|
|
||||||
# because its get_endpoint() method isn't yet set up to handle interface as
|
|
||||||
# a list. (It could also happen with a real auth if the endpoint isn't
|
|
||||||
# there; but that's covered below.)
|
|
||||||
try:
|
|
||||||
return ksa_adapter.get_endpoint()
|
return ksa_adapter.get_endpoint()
|
||||||
except ks_exc.EndpointNotFound:
|
|
||||||
pass
|
|
||||||
|
|
||||||
interfaces = list(ksa_adapter.interface)
|
|
||||||
for interface in interfaces:
|
|
||||||
ksa_adapter.interface = interface
|
|
||||||
try:
|
|
||||||
return ksa_adapter.get_endpoint()
|
|
||||||
except ks_exc.EndpointNotFound:
|
|
||||||
pass
|
|
||||||
raise ks_exc.EndpointNotFound(
|
|
||||||
"Could not find requested endpoint for any of the following "
|
|
||||||
"interfaces: %s" % interfaces)
|
|
||||||
|
|
||||||
|
|
||||||
def generate_hostid(host, project_id):
|
def generate_hostid(host, project_id):
|
||||||
|
|
Loading…
Reference in New Issue