aboutsummaryrefslogtreecommitdiffstats
path: root/keystone-moon
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2015-10-12 15:05:19 +0200
committerasteroide <thomas.duval@orange.com>2015-10-12 15:05:19 +0200
commit5ae7905d74dc7536872eeb37629bf86c09eaca2b (patch)
treee24a1c559324495db09cf9b6cad1aebb653a7a3d /keystone-moon
parenta363067a1bdf411c28032b926b451fc9d0964dc6 (diff)
Fix a bug when sending a new log in moon_api.
Change-Id: I8a457018bd2e03f2fcaed3143d2c4c2df7bcfbf7
Diffstat (limited to 'keystone-moon')
-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