aboutsummaryrefslogtreecommitdiffstats
path: root/keystone-moon/keystone/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'keystone-moon/keystone/contrib')
-rw-r--r--keystone-moon/keystone/contrib/moon/core.py8
-rw-r--r--keystone-moon/keystone/contrib/moon/exception.py31
2 files changed, 30 insertions, 9 deletions
diff --git a/keystone-moon/keystone/contrib/moon/core.py b/keystone-moon/keystone/contrib/moon/core.py
index 8e56f135..586356bf 100644
--- a/keystone-moon/keystone/contrib/moon/core.py
+++ b/keystone-moon/keystone/contrib/moon/core.py
@@ -352,7 +352,6 @@ class ConfigurationManager(manager.Manager):
@dependency.provider('tenant_api')
-@dependency.requires('admin_api', 'resource_api', 'root_api')
@dependency.requires('moonlog_api', 'admin_api', 'configuration_api', 'root_api', 'resource_api')
class TenantManager(manager.Manager):
@@ -909,7 +908,10 @@ class IntraExtensionManager(manager.Manager):
ie_dict["genre"] = "admin"
ie_dict["description"] = "policy_root"
ref = self.driver.set_intra_extension_dict(ie_dict['id'], ie_dict)
- self.moonlog_api.debug("Creation of root IE: {}".format(ref))
+ try:
+ self.moonlog_api.debug("Creation of root IE: {}".format(ref))
+ except AttributeError:
+ LOG.debug("Creation of root IE: {}".format(ref))
# read the template given by "model" and populate default variables
template_dir = os.path.join(CONF.moon.policy_directory, ie_dict["model"])
@@ -2112,7 +2114,7 @@ class IntraExtensionAdminManager(IntraExtensionManager):
@dependency.provider('root_api')
-#@dependency.requires('admin_api')
+@dependency.requires('admin_api', 'moonlog_api')
class IntraExtensionRootManager(IntraExtensionManager):
def __init__(self):
diff --git a/keystone-moon/keystone/contrib/moon/exception.py b/keystone-moon/keystone/contrib/moon/exception.py
index d94e9bfc..4e9bf7c9 100644
--- a/keystone-moon/keystone/contrib/moon/exception.py
+++ b/keystone-moon/keystone/contrib/moon/exception.py
@@ -7,6 +7,10 @@ from keystone.common import dependency
from keystone.exception import Error
from keystone.i18n import _, _LW
import logging
+from oslo_log import log
+
+LOG = log.getLogger(__name__)
+
class MoonErrorMetaClass(type):
@@ -32,16 +36,31 @@ class MoonError(Error):
def __del__(self):
message = "{} ({})".format(self.hierarchy, self.message_format)
if self.logger == "ERROR":
- self.moonlog_api.error(message)
+ try:
+ self.moonlog_api.error(message)
+ except AttributeError:
+ LOG.error(message)
elif self.logger == "WARNING":
- self.moonlog_api.warning(message)
+ try:
+ self.moonlog_api.warning(message)
+ except AttributeError:
+ LOG.warning(message)
elif self.logger == "CRITICAL":
- self.moonlog_api.critical(message)
+ try:
+ self.moonlog_api.critical(message)
+ except AttributeError:
+ LOG.critical(message)
elif self.logger == "AUTHZ":
- self.moonlog_api.authz(self.hierarchy)
- self.moonlog_api.error(message)
+ try:
+ self.moonlog_api.authz(self.hierarchy)
+ self.moonlog_api.error(message)
+ except AttributeError:
+ LOG.error(message)
else:
- self.moonlog_api.info(message)
+ try:
+ self.moonlog_api.info(message)
+ except AttributeError:
+ LOG.info(message)
# Exceptions for Tenant