Created new class KeystoneException 47/37547/2
authorspisarski <s.pisarski@cablelabs.com>
Fri, 14 Jul 2017 21:44:23 +0000 (15:44 -0600)
committerspisarski <s.pisarski@cablelabs.com>
Mon, 17 Jul 2017 15:12:50 +0000 (09:12 -0600)
Raising KeystoneException in keystone_utils.py instead of Exception

JIRA: SNAPS-127

Change-Id: Ife37c9df79c5c85dfdb07e239268c05b7c9a91bd
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
snaps/openstack/utils/keystone_utils.py

index 92e4b64..c671b18 100644 (file)
@@ -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
+    """