aboutsummaryrefslogtreecommitdiffstats
path: root/keystone-moon/keystone
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2015-10-12 13:09:28 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2015-10-12 13:09:28 +0000
commita93fe4376a4db328635eef117241d78fcb3773f0 (patch)
tree84e73f5564510a36c2bbd223967a20e6b7a00c87 /keystone-moon/keystone
parent6026d8b28302f131e58a17526375319dbdd524ae (diff)
parent5ae7905d74dc7536872eeb37629bf86c09eaca2b (diff)
Merge "Fix a bug when sending a new log in moon_api."
Diffstat (limited to 'keystone-moon/keystone')
-rw-r--r--keystone-moon/keystone/contrib/moon/core.py12
-rw-r--r--keystone-moon/keystone/contrib/moon/exception.py8
2 files changed, 13 insertions, 7 deletions
diff --git a/keystone-moon/keystone/contrib/moon/core.py b/keystone-moon/keystone/contrib/moon/core.py
index 1b07dfd1..4f8074f7 100644
--- a/keystone-moon/keystone/contrib/moon/core.py
+++ b/keystone-moon/keystone/contrib/moon/core.py
@@ -1239,14 +1239,14 @@ class IntraExtensionManager(manager.Manager):
def get_object_dict(self, user_id, intra_extension_id, object_id):
objects_dict = self.driver.get_objects_dict(intra_extension_id)
if object_id not in objects_dict:
- raise ObjectUnknown()
+ raise ObjectUnknown("Unknown object name: {}".format(object_id))
return objects_dict[object_id]
@filter_input
@enforce(("read", "write"), "objects")
def del_object(self, user_id, intra_extension_id, object_id):
if object_id not in self.driver.get_objects_dict(intra_extension_id):
- raise ObjectUnknown()
+ raise ObjectUnknown("Unknown object name: {}".format(object_id))
# Destroy assignments related to this category
for object_category_id in self.driver.get_object_categories_dict(intra_extension_id):
for _object_id in self.driver.get_objects_dict(intra_extension_id):
@@ -1570,7 +1570,7 @@ class IntraExtensionManager(manager.Manager):
@enforce("read", "object_categories")
def get_object_assignment_list(self, user_id, intra_extension_id, object_id, object_category_id):
if object_id not in self.driver.get_objects_dict(intra_extension_id):
- raise ObjectUnknown()
+ raise ObjectUnknown("Unknown object name: {}".format(object_id))
if object_category_id not in self.driver.get_object_categories_dict(intra_extension_id):
raise ObjectCategoryUnknown()
return self.driver.get_object_assignment_list(intra_extension_id, object_id, object_category_id)
@@ -1581,7 +1581,7 @@ class IntraExtensionManager(manager.Manager):
@enforce("read", "object_categories")
def add_object_assignment_list(self, user_id, intra_extension_id, object_id, object_category_id, object_scope_id):
if object_id not in self.driver.get_objects_dict(intra_extension_id):
- raise ObjectUnknown()
+ raise ObjectUnknown("Unknown object name: {}".format(object_id))
if object_category_id not in self.driver.get_object_categories_dict(intra_extension_id):
raise ObjectCategoryUnknown()
if object_scope_id not in self.driver.get_object_scopes_dict(intra_extension_id, object_category_id):
@@ -1597,7 +1597,7 @@ class IntraExtensionManager(manager.Manager):
@enforce("read", "object_scopes")
def del_object_assignment(self, user_id, intra_extension_id, object_id, object_category_id, object_scope_id):
if object_id not in self.driver.get_objects_dict(intra_extension_id):
- raise ObjectUnknown()
+ raise ObjectUnknown("Unknown object name: {}".format(object_id))
if object_category_id not in self.driver.get_object_categories_dict(intra_extension_id):
raise ObjectCategoryUnknown()
if object_scope_id not in self.driver.get_object_scopes_dict(intra_extension_id, object_category_id):
@@ -1839,7 +1839,7 @@ class IntraExtensionAuthzManager(IntraExtensionManager):
object_id = _object_id
break
if not object_id:
- raise ObjectUnknown()
+ raise ObjectUnknown("Unknown object name: {}".format(object_id))
actions_dict = self.driver.get_actions_dict(intra_extension_id)
action_id = None
diff --git a/keystone-moon/keystone/contrib/moon/exception.py b/keystone-moon/keystone/contrib/moon/exception.py
index 6242447f..d94e9bfc 100644
--- a/keystone-moon/keystone/contrib/moon/exception.py
+++ b/keystone-moon/keystone/contrib/moon/exception.py
@@ -6,7 +6,7 @@
from keystone.common import dependency
from keystone.exception import Error
from keystone.i18n import _, _LW
-
+import logging
class MoonErrorMetaClass(type):
@@ -24,6 +24,11 @@ class MoonError(Error):
title = 'Moon Error'
logger = "ERROR"
+ def __init__(self, message=""):
+ if message:
+ self.message_format = message
+ super(MoonError, self).__init__()
+
def __del__(self):
message = "{} ({})".format(self.hierarchy, self.message_format)
if self.logger == "ERROR":
@@ -97,6 +102,7 @@ class RootExtensionUnknown(IntraExtensionUnknown):
title = 'Root Extension Unknown'
logger = "Error"
+
class RootExtensionNotInitialized(IntraExtensionException):
message_format = _("The root_extension is not initialized.")
code = 400