Catch correct exception in check_cinder_exists fct

Change-Id: I8825629f0a634352b8dcf03112003ad4d7f9af71
Closes-bug: #1640738
(cherry picked from commit e297d13544)
This commit is contained in:
Sergey Reshetnyak 2016-11-10 13:17:46 +03:00 committed by Sergey Kraynev
parent 7fa80fb5ef
commit 6119eecce8
2 changed files with 4 additions and 4 deletions

View File

@ -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())

View File

@ -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