diff --git a/sahara/tests/unit/utils/test_cinder.py b/sahara/tests/unit/utils/test_cinder.py index 197e1323..2d66addb 100644 --- a/sahara/tests/unit/utils/test_cinder.py +++ b/sahara/tests/unit/utils/test_cinder.py @@ -14,10 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from keystoneauth1 import exceptions as keystone_exceptions import mock from oslo_config import cfg -from sahara import exceptions as ex from sahara import main from sahara.tests.unit import base as test_base from sahara.utils.openstack import cinder @@ -65,7 +65,7 @@ class TestCinder(test_base.SaharaTestCase): mock_url_for.reset_mock() - mock_url_for.side_effect = ex.SystemError("BANANA") + mock_url_for.side_effect = keystone_exceptions.EndpointNotFound() self.assertFalse(cinder.check_cinder_exists()) diff --git a/sahara/utils/openstack/cinder.py b/sahara/utils/openstack/cinder.py index 9827ecd9..02e72a30 100644 --- a/sahara/utils/openstack/cinder.py +++ b/sahara/utils/openstack/cinder.py @@ -16,11 +16,11 @@ # limitations under the License. from cinderclient.v2 import client as cinder_client_v2 +from keystoneauth1 import exceptions as keystone_exceptions from oslo_config import cfg from oslo_log import log as logging from sahara import context -from sahara import exceptions as ex from sahara.i18n import _LW from sahara.service import sessions from sahara.utils.openstack import base @@ -79,7 +79,7 @@ def check_cinder_exists(): base.url_for(context.current().service_catalog, service_type, endpoint_type=CONF.cinder.endpoint_type) return True - except ex.SystemError: + except keystone_exceptions.EndpointNotFound: return False