Merge "Catch correct exception in check_cinder_exists fct"
This commit is contained in:
commit
a182fea250
@ -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())
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user