summaryrefslogtreecommitdiffstats
path: root/keystone-moon/keystone/contrib/moon/service.py
diff options
context:
space:
mode:
Diffstat (limited to 'keystone-moon/keystone/contrib/moon/service.py')
-rw-r--r--keystone-moon/keystone/contrib/moon/service.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/keystone-moon/keystone/contrib/moon/service.py b/keystone-moon/keystone/contrib/moon/service.py
new file mode 100644
index 00000000..cd68e98a
--- /dev/null
+++ b/keystone-moon/keystone/contrib/moon/service.py
@@ -0,0 +1,57 @@
+import functools
+import sys
+
+from oslo_config import cfg
+from oslo_log import log
+from paste import deploy
+import routes
+from keystone.contrib.moon.routers import Routers
+
+from keystone import assignment
+from keystone import auth
+from keystone import catalog
+from keystone.common import wsgi
+from keystone import controllers
+from keystone import credential
+from keystone import endpoint_policy
+from keystone import identity
+from keystone import policy
+from keystone import resource
+from keystone import routers
+from keystone import token
+from keystone import trust
+
+
+CONF = cfg.CONF
+LOG = log.getLogger(__name__)
+
+
+# def loadapp(conf, name):
+# # NOTE(blk-u): Save the application being loaded in the controllers module.
+# # This is similar to how public_app_factory() and v3_app_factory()
+# # register the version with the controllers module.
+# controllers.latest_app = deploy.loadapp(conf, name=name)
+# return controllers.latest_app
+
+
+def fail_gracefully(f):
+ """Logs exceptions and aborts."""
+ @functools.wraps(f)
+ def wrapper(*args, **kw):
+ try:
+ return f(*args, **kw)
+ except Exception as e:
+ LOG.debug(e, exc_info=True)
+
+ # exception message is printed to all logs
+ LOG.critical(e)
+ sys.exit(1)
+
+ return wrapper
+
+
+@fail_gracefully
+def moon_app_factory(global_conf, **local_conf):
+ return wsgi.ComposingRouter(routes.Mapper(),
+ [Routers('moon_service')])
+