Merge "nova: use EndpointNotFound from keystoneauth1"
This commit is contained in:
commit
e17b78aa19
@ -16,6 +16,7 @@
|
|||||||
Handles all requests to Nova.
|
Handles all requests to Nova.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from keystoneauth1 import exceptions as ks_exc
|
||||||
from keystoneauth1 import identity
|
from keystoneauth1 import identity
|
||||||
from keystoneauth1 import loading as ks_loading
|
from keystoneauth1 import loading as ks_loading
|
||||||
from novaclient import api_versions
|
from novaclient import api_versions
|
||||||
@ -77,7 +78,7 @@ def _get_identity_endpoint_from_sc(context):
|
|||||||
if (not CONF[NOVA_GROUP].region_name or
|
if (not CONF[NOVA_GROUP].region_name or
|
||||||
endpoint.get('region') == CONF[NOVA_GROUP].region_name):
|
endpoint.get('region') == CONF[NOVA_GROUP].region_name):
|
||||||
return endpoint.get(CONF[NOVA_GROUP].interface + 'URL')
|
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):
|
def novaclient(context, privileged_user=False, timeout=None, api_version=None):
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
|
from keystoneauth1 import exceptions as ks_exc
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from cinder.compute import nova
|
from cinder.compute import nova
|
||||||
@ -171,11 +172,10 @@ class NovaClientTestCase(test.TestCase):
|
|||||||
global_request_id=self.ctx.request_id,
|
global_request_id=self.ctx.request_id,
|
||||||
timeout=None, extensions=nova.nova_extensions)
|
timeout=None, extensions=nova.nova_extensions)
|
||||||
|
|
||||||
def test_novaclient_exceptions(self):
|
def test_get_identity_endpoint_from_sc_endpoint_not_found(self):
|
||||||
# This is to prevent regression if exceptions are
|
ctxt = context.get_admin_context()
|
||||||
# removed from novaclient since the service catalog
|
self.assertRaises(ks_exc.EndpointNotFound,
|
||||||
# code does not have thorough tests.
|
nova._get_identity_endpoint_from_sc, ctxt)
|
||||||
self.assertTrue(hasattr(nova_exceptions, 'EndpointNotFound'))
|
|
||||||
|
|
||||||
|
|
||||||
class FakeNovaClient(object):
|
class FakeNovaClient(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user