summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keystoneclient/base.py17
-rw-r--r--keystoneclient/tests/unit/test_utils.py14
-rw-r--r--keystoneclient/tests/unit/v2_0/test_tenants.py2
-rw-r--r--keystoneclient/tests/unit/v2_0/test_tokens.py2
-rw-r--r--keystoneclient/tests/unit/v3/test_federation.py2
-rw-r--r--keystoneclient/tests/unit/v3/test_projects.py10
-rw-r--r--keystoneclient/tests/unit/v3/test_tokens.py2
-rw-r--r--keystoneclient/utils.py15
-rw-r--r--keystoneclient/v2_0/tokens.py2
-rw-r--r--keystoneclient/v3/auth.py2
-rw-r--r--keystoneclient/v3/contrib/federation/base.py4
11 files changed, 39 insertions, 33 deletions
diff --git a/keystoneclient/base.py b/keystoneclient/base.py
index fc16298..7067fb8 100644
--- a/keystoneclient/base.py
+++ b/keystoneclient/base.py
@@ -22,12 +22,13 @@ import copy
import functools
import warnings
+from keystoneauth1 import exceptions as ksa_exceptions
from keystoneauth1 import plugin
from oslo_utils import strutils
import six
from six.moves import urllib
-from keystoneclient import exceptions
+from keystoneclient import exceptions as ksc_exceptions
from keystoneclient.i18n import _
@@ -226,8 +227,8 @@ class Manager(object):
resp, body = methods[method](url, body=body,
**kwargs)
except KeyError:
- raise exceptions.ClientException(_("Invalid update method: %s")
- % method)
+ raise ksc_exceptions.ClientException(_("Invalid update method: %s")
+ % method)
# PUT requests may not return a body
if body:
return self.resource_class(self, body[response_key])
@@ -253,9 +254,9 @@ class ManagerWithFind(Manager):
if num == 0:
msg = _("No %(name)s matching %(kwargs)s.") % {
'name': self.resource_class.__name__, 'kwargs': kwargs}
- raise exceptions.NotFound(404, msg)
+ raise ksa_exceptions.NotFound(404, msg)
elif num > 1:
- raise exceptions.NoUniqueMatch
+ raise ksc_exceptions.NoUniqueMatch
else:
return rl[0]
@@ -384,7 +385,7 @@ class CrudManager(Manager):
return self._list(
url_query,
self.collection_key)
- except exceptions.EmptyCatalog:
+ except ksa_exceptions.EmptyCatalog:
if fallback_to_auth:
return self._list(
url_query,
@@ -431,9 +432,9 @@ class CrudManager(Manager):
if num == 0:
msg = _("No %(name)s matching %(kwargs)s.") % {
'name': self.resource_class.__name__, 'kwargs': kwargs}
- raise exceptions.NotFound(404, msg)
+ raise ksa_exceptions.NotFound(404, msg)
elif num > 1:
- raise exceptions.NoUniqueMatch
+ raise ksc_exceptions.NoUniqueMatch
else:
return rl[0]
diff --git a/keystoneclient/tests/unit/test_utils.py b/keystoneclient/tests/unit/test_utils.py
index da51e7f..0144331 100644
--- a/keystoneclient/tests/unit/test_utils.py
+++ b/keystoneclient/tests/unit/test_utils.py
@@ -10,11 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
+from keystoneauth1 import exceptions as ksa_exceptions
import six
import testresources
from testtools import matchers
-from keystoneclient import exceptions
+
+from keystoneclient import exceptions as ksc_exceptions
from keystoneclient.tests.unit import client_fixtures
from keystoneclient.tests.unit import utils as test_utils
from keystoneclient import utils
@@ -39,16 +41,16 @@ class FakeManager(object):
try:
return self.resources[str(resource_id)]
except KeyError:
- raise exceptions.NotFound(resource_id)
+ raise ksa_exceptions.NotFound(resource_id)
def find(self, name=None):
if name == '9999':
# NOTE(morganfainberg): special case that raises NoUniqueMatch.
- raise exceptions.NoUniqueMatch()
+ raise ksc_exceptions.NoUniqueMatch()
for resource_id, resource in self.resources.items():
if resource['name'] == str(name):
return resource
- raise exceptions.NotFound(name)
+ raise ksa_exceptions.NotFound(name)
class FindResourceTestCase(test_utils.TestCase):
@@ -58,7 +60,7 @@ class FindResourceTestCase(test_utils.TestCase):
self.manager = FakeManager()
def test_find_none(self):
- self.assertRaises(exceptions.CommandError,
+ self.assertRaises(ksc_exceptions.CommandError,
utils.find_resource,
self.manager,
'asdf')
@@ -90,7 +92,7 @@ class FindResourceTestCase(test_utils.TestCase):
self.assertEqual(output, self.manager.resources['5678'])
def test_find_no_unique_match(self):
- self.assertRaises(exceptions.CommandError,
+ self.assertRaises(ksc_exceptions.CommandError,
utils.find_resource,
self.manager,
9999)
diff --git a/keystoneclient/tests/unit/v2_0/test_tenants.py b/keystoneclient/tests/unit/v2_0/test_tenants.py
index 0187d57..5e78aa3 100644
--- a/keystoneclient/tests/unit/v2_0/test_tenants.py
+++ b/keystoneclient/tests/unit/v2_0/test_tenants.py
@@ -12,9 +12,9 @@
import uuid
+from keystoneauth1 import exceptions
from keystoneauth1 import fixture
-from keystoneclient import exceptions
from keystoneclient.tests.unit.v2_0 import utils
from keystoneclient.v2_0 import client
from keystoneclient.v2_0 import tenants
diff --git a/keystoneclient/tests/unit/v2_0/test_tokens.py b/keystoneclient/tests/unit/v2_0/test_tokens.py
index 2b6823f..58df7c2 100644
--- a/keystoneclient/tests/unit/v2_0/test_tokens.py
+++ b/keystoneclient/tests/unit/v2_0/test_tokens.py
@@ -12,10 +12,10 @@
import uuid
+from keystoneauth1 import exceptions
from keystoneauth1 import fixture
from keystoneclient import access
-from keystoneclient import exceptions
from keystoneclient.tests.unit.v2_0 import utils
from keystoneclient.v2_0 import client
from keystoneclient.v2_0 import tokens
diff --git a/keystoneclient/tests/unit/v3/test_federation.py b/keystoneclient/tests/unit/v3/test_federation.py
index ceefae7..a760ed7 100644
--- a/keystoneclient/tests/unit/v3/test_federation.py
+++ b/keystoneclient/tests/unit/v3/test_federation.py
@@ -13,6 +13,7 @@
import copy
import uuid
+from keystoneauth1 import exceptions
from keystoneauth1 import fixture
from keystoneauth1.identity import v3
from keystoneauth1 import session
@@ -21,7 +22,6 @@ import six
from testtools import matchers
from keystoneclient import access
-from keystoneclient import exceptions
from keystoneclient.tests.unit.v3 import utils
from keystoneclient.v3 import client
from keystoneclient.v3.contrib.federation import base
diff --git a/keystoneclient/tests/unit/v3/test_projects.py b/keystoneclient/tests/unit/v3/test_projects.py
index 8bd6fd5..48477ed 100644
--- a/keystoneclient/tests/unit/v3/test_projects.py
+++ b/keystoneclient/tests/unit/v3/test_projects.py
@@ -12,7 +12,9 @@
import uuid
-from keystoneclient import exceptions
+from keystoneauth1 import exceptions as ksa_exceptions
+
+from keystoneclient import exceptions as ksc_exceptions
from keystoneclient.tests.unit.v3 import utils
from keystoneclient.v3 import projects
@@ -284,7 +286,7 @@ class ProjectTests(utils.ClientTestCase, utils.CrudTests):
def test_get_with_invalid_parameters_combination(self):
# subtree_as_list and subtree_as_ids can not be included at the
# same time in the call.
- self.assertRaises(exceptions.ValidationError,
+ self.assertRaises(ksc_exceptions.ValidationError,
self.manager.get,
project=uuid.uuid4().hex,
subtree_as_list=True,
@@ -292,7 +294,7 @@ class ProjectTests(utils.ClientTestCase, utils.CrudTests):
# parents_as_list and parents_as_ids can not be included at the
# same time in the call.
- self.assertRaises(exceptions.ValidationError,
+ self.assertRaises(ksc_exceptions.ValidationError,
self.manager.get,
project=uuid.uuid4().hex,
parents_as_list=True,
@@ -308,5 +310,5 @@ class ProjectTests(utils.ClientTestCase, utils.CrudTests):
# NOTE(rodrigods): this is the expected behaviour of the Identity
# server, a different implementation might not fail this request.
- self.assertRaises(exceptions.Forbidden, self.manager.update,
+ self.assertRaises(ksa_exceptions.Forbidden, self.manager.update,
ref['id'], **utils.parameterize(req_ref))
diff --git a/keystoneclient/tests/unit/v3/test_tokens.py b/keystoneclient/tests/unit/v3/test_tokens.py
index 7c82d37..0208f53 100644
--- a/keystoneclient/tests/unit/v3/test_tokens.py
+++ b/keystoneclient/tests/unit/v3/test_tokens.py
@@ -12,10 +12,10 @@
import uuid
+from keystoneauth1 import exceptions
import testresources
from keystoneclient import access
-from keystoneclient import exceptions
from keystoneclient.tests.unit import client_fixtures
from keystoneclient.tests.unit.v3 import utils
diff --git a/keystoneclient/utils.py b/keystoneclient/utils.py
index 7030f51..4685111 100644
--- a/keystoneclient/utils.py
+++ b/keystoneclient/utils.py
@@ -15,13 +15,14 @@ import hashlib
import logging
import sys
+from keystoneauth1 import exceptions as ksa_exceptions
from oslo_utils import timeutils
# NOTE(stevemar): do not remove positional. We need this to stay for a while
# since versions of auth_token require it here.
from positional import positional # noqa
import six
-from keystoneclient import exceptions
+from keystoneclient import exceptions as ksc_exceptions
logger = logging.getLogger(__name__)
@@ -32,8 +33,8 @@ def find_resource(manager, name_or_id):
# first try the entity as a string
try:
return manager.get(name_or_id)
- except (exceptions.NotFound): # nosec(cjschaef): try to find 'name_or_id'
- # as a six.binary_type instead
+ except (ksa_exceptions.NotFound): # nosec(cjschaef): try to find
+ # 'name_or_id' as a six.binary_type instead
pass
# finally try to find entity by name
@@ -41,15 +42,15 @@ def find_resource(manager, name_or_id):
if isinstance(name_or_id, six.binary_type):
name_or_id = name_or_id.decode('utf-8', 'strict')
return manager.find(name=name_or_id)
- except exceptions.NotFound:
+ except ksa_exceptions.NotFound:
msg = ("No %s with a name or ID of '%s' exists." %
(manager.resource_class.__name__.lower(), name_or_id))
- raise exceptions.CommandError(msg)
- except exceptions.NoUniqueMatch:
+ raise ksc_exceptions.CommandError(msg)
+ except ksc_exceptions.NoUniqueMatch:
msg = ("Multiple %s matches found for '%s', use an ID to be more"
" specific." % (manager.resource_class.__name__.lower(),
name_or_id))
- raise exceptions.CommandError(msg)
+ raise ksc_exceptions.CommandError(msg)
def unauthenticated(f):
diff --git a/keystoneclient/v2_0/tokens.py b/keystoneclient/v2_0/tokens.py
index b5f9657..8e64796 100644
--- a/keystoneclient/v2_0/tokens.py
+++ b/keystoneclient/v2_0/tokens.py
@@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from keystoneauth1 import exceptions
from keystoneauth1 import plugin
from positional import positional
from keystoneclient import access
from keystoneclient import base
-from keystoneclient import exceptions
from keystoneclient.i18n import _
diff --git a/keystoneclient/v3/auth.py b/keystoneclient/v3/auth.py
index 6272dbc..0009a3a 100644
--- a/keystoneclient/v3/auth.py
+++ b/keystoneclient/v3/auth.py
@@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from keystoneauth1 import exceptions
from keystoneauth1 import plugin
from keystoneclient import base
-from keystoneclient import exceptions
from keystoneclient.v3 import domains
from keystoneclient.v3 import projects
diff --git a/keystoneclient/v3/contrib/federation/base.py b/keystoneclient/v3/contrib/federation/base.py
index 5e2e9e7..98567a2 100644
--- a/keystoneclient/v3/contrib/federation/base.py
+++ b/keystoneclient/v3/contrib/federation/base.py
@@ -12,11 +12,11 @@
import abc
+from keystoneauth1 import exceptions
from keystoneauth1 import plugin
import six
from keystoneclient import base
-from keystoneclient import exceptions
@six.add_metaclass(abc.ABCMeta)
@@ -33,7 +33,7 @@ class EntityManager(base.Manager):
url = '/auth/%s' % self.object_type
try:
tenant_list = self._list(url, self.object_type)
- except exceptions.EndpointException:
+ except exceptions.CatalogException:
endpoint_filter = {'interface': plugin.AUTH_INTERFACE}
tenant_list = self._list(url, self.object_type,
endpoint_filter=endpoint_filter)