summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Pisarski <s.pisarski@cablelabs.com>2017-07-17 15:14:04 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-17 15:14:04 +0000
commit0f47ac44b59932544c45bd6df82a31aedb85b16f (patch)
treecba656b88e994e69cd7b5215ecf5652b5a65d219
parent39328c7d6f0582124b61a6c18fa10d8d245eecf2 (diff)
parent7af054b7b2f26981d1883e31aecacf9d341ddb4d (diff)
Merge "Created new class KeystoneException"
-rw-r--r--snaps/openstack/utils/keystone_utils.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/snaps/openstack/utils/keystone_utils.py b/snaps/openstack/utils/keystone_utils.py
index 92e4b64..c671b18 100644
--- a/snaps/openstack/utils/keystone_utils.py
+++ b/snaps/openstack/utils/keystone_utils.py
@@ -111,8 +111,8 @@ def get_project(keystone=None, os_creds=None, project_name=None):
if os_creds:
keystone = keystone_client(os_creds)
else:
- raise Exception('Cannot lookup project without the proper '
- 'credentials')
+ raise KeystoneException(
+ 'Cannot lookup project without the proper credentials')
if keystone.version == V2_VERSION:
projects = keystone.tenants.list()
@@ -324,3 +324,9 @@ def grant_user_role_to_project(keystone, role, user, project):
keystone.roles.add_user_role(user, os_role, tenant=project)
else:
keystone.roles.grant(os_role, user=user, project=project)
+
+
+class KeystoneException(Exception):
+ """
+ Exception when calls to the Keystone client cannot be served properly
+ """