summaryrefslogtreecommitdiffstats
path: root/keystone/catalog
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2012-12-12 13:17:54 -0500
committerAdam Young <ayoung@redhat.com>2012-12-17 13:58:22 -0500
commitfb963a560939e6be8c98d74e5555de7283173e32 (patch)
treeca39d11535eba792ec67e03818aab5f46f823b0c /keystone/catalog
parent44e3c3ece3f6e8a596dbec37476d8fb5c85d6f6c (diff)
downloadkeystone-fb963a560939e6be8c98d74e5555de7283173e32.tar.gz
keystone-fb963a560939e6be8c98d74e5555de7283173e32.tar.xz
keystone-fb963a560939e6be8c98d74e5555de7283173e32.zip
module refactoring
Distributes the functionality of service.py into the modules. Moves ComposableRouters into the modules. The routers and controllers now have short names. The controllers get their APIs via the base class. Change-Id: I87404b80ea9800d6792f97a7a3a64fe839065c1c
Diffstat (limited to 'keystone/catalog')
-rw-r--r--keystone/catalog/__init__.py1
-rw-r--r--keystone/catalog/controllers.py20
-rw-r--r--keystone/catalog/routers.py25
3 files changed, 28 insertions, 18 deletions
diff --git a/keystone/catalog/__init__.py b/keystone/catalog/__init__.py
index c029a486..9c710151 100644
--- a/keystone/catalog/__init__.py
+++ b/keystone/catalog/__init__.py
@@ -16,3 +16,4 @@
from keystone.catalog.core import *
from keystone.catalog import controllers
+from keystone.catalog import routers
diff --git a/keystone/catalog/controllers.py b/keystone/catalog/controllers.py
index b58f3d07..b0460fc9 100644
--- a/keystone/catalog/controllers.py
+++ b/keystone/catalog/controllers.py
@@ -20,18 +20,9 @@ import uuid
from keystone.catalog import core
from keystone.common import controller
from keystone.common import wsgi
-from keystone import identity
-from keystone import policy
-from keystone import token
-class Service(wsgi.Application):
- def __init__(self):
- self.catalog_api = core.Manager()
- self.identity_api = identity.Manager()
- self.policy_api = policy.Manager()
- self.token_api = token.Manager()
- super(Service, self).__init__()
+class Service(controller.V2Controller):
def get_services(self, context):
self.assert_admin(context)
@@ -57,14 +48,7 @@ class Service(wsgi.Application):
return {'OS-KSADM:service': new_service_ref}
-class Endpoint(wsgi.Application):
- def __init__(self):
- self.catalog_api = core.Manager()
- self.identity_api = identity.Manager()
- self.policy_api = policy.Manager()
- self.token_api = token.Manager()
- super(Endpoint, self).__init__()
-
+class Endpoint(controller.V2Controller):
def get_endpoints(self, context):
self.assert_admin(context)
endpoint_list = self.catalog_api.list_endpoints(context)
diff --git a/keystone/catalog/routers.py b/keystone/catalog/routers.py
new file mode 100644
index 00000000..f0c547f8
--- /dev/null
+++ b/keystone/catalog/routers.py
@@ -0,0 +1,25 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 OpenStack LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+from keystone.catalog import controllers
+from keystone.common import router
+from keystone.common import wsgi
+
+
+def append_v3_routers(mapper, routers, apis):
+ routers.append(router.Router(controllers.ServiceV3(**apis),
+ 'services', 'service'))
+ routers.append(router.Router(controllers.EndpointV3(**apis),
+ 'endpoints', 'endpoint'))