Merge "nova: use EndpointNotFound from keystoneauth1"

This commit is contained in:
Zuul 2019-09-03 22:13:01 +00:00 committed by Gerrit Code Review
commit e17b78aa19
2 changed files with 7 additions and 6 deletions

View File

@ -16,6 +16,7 @@
Handles all requests to Nova.
"""
from keystoneauth1 import exceptions as ks_exc
from keystoneauth1 import identity
from keystoneauth1 import loading as ks_loading
from novaclient import api_versions
@ -77,7 +78,7 @@ def _get_identity_endpoint_from_sc(context):
if (not CONF[NOVA_GROUP].region_name or
endpoint.get('region') == CONF[NOVA_GROUP].region_name):
return endpoint.get(CONF[NOVA_GROUP].interface + 'URL')
raise nova_exceptions.EndpointNotFound()
raise ks_exc.EndpointNotFound()
def novaclient(context, privileged_user=False, timeout=None, api_version=None):

View File

@ -13,6 +13,7 @@
# under the License.
import ddt
from keystoneauth1 import exceptions as ks_exc
import mock
from cinder.compute import nova
@ -171,11 +172,10 @@ class NovaClientTestCase(test.TestCase):
global_request_id=self.ctx.request_id,
timeout=None, extensions=nova.nova_extensions)
def test_novaclient_exceptions(self):
# This is to prevent regression if exceptions are
# removed from novaclient since the service catalog
# code does not have thorough tests.
self.assertTrue(hasattr(nova_exceptions, 'EndpointNotFound'))
def test_get_identity_endpoint_from_sc_endpoint_not_found(self):
ctxt = context.get_admin_context()
self.assertRaises(ks_exc.EndpointNotFound,
nova._get_identity_endpoint_from_sc, ctxt)
class FakeNovaClient(object):