rename templated.TemplatedCatalog to templated.Catalog

This addresses a long standing TODO for consistency across catalog
drivers, making it more intuitive to switch drivers.

UpgradeImpact

Change-Id: I109513695e60867d1111795ab958a3cc4240e831
This commit is contained in:
Dolph Mathews 2014-01-16 08:18:13 -06:00
parent e54a6a353c
commit 6670a48a17
6 changed files with 18 additions and 12 deletions

View File

@ -467,8 +467,8 @@ To build your service catalog using this driver, see the built-in help::
You can also refer to `an example in Keystone (tools/sample_data.sh) You can also refer to `an example in Keystone (tools/sample_data.sh)
<https://github.com/openstack/keystone/blob/master/tools/sample_data.sh>`_. <https://github.com/openstack/keystone/blob/master/tools/sample_data.sh>`_.
File-based Service Catalog (``templated.TemplatedCatalog``) File-based Service Catalog (``templated.Catalog``)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The templated catalog is an in-memory backend initialized from a read-only The templated catalog is an in-memory backend initialized from a read-only
``template_file``. Choose this option only if you know that your ``template_file``. Choose this option only if you know that your
@ -485,7 +485,7 @@ service catalog will not change very much over time.
``keystone.conf`` example:: ``keystone.conf`` example::
[catalog] [catalog]
driver = keystone.catalog.backends.templated.TemplatedCatalog driver = keystone.catalog.backends.templated.Catalog
template_file = /opt/stack/keystone/etc/default_catalog.templates template_file = /opt/stack/keystone/etc/default_catalog.templates
The value of ``template_file`` is expected to be an absolute path to your The value of ``template_file`` is expected to be an absolute path to your

View File

@ -1,4 +1,4 @@
# config for TemplatedCatalog, using camelCase because I don't want to do # config for templated.Catalog, using camelCase because I don't want to do
# translations for keystone compat # translations for keystone compat
catalog.RegionOne.identity.publicURL = http://localhost:$(public_port)s/v2.0 catalog.RegionOne.identity.publicURL = http://localhost:$(public_port)s/v2.0
catalog.RegionOne.identity.adminURL = http://localhost:$(admin_port)s/v2.0 catalog.RegionOne.identity.adminURL = http://localhost:$(admin_port)s/v2.0

View File

@ -237,7 +237,7 @@
# driver = keystone.catalog.backends.sql.Catalog # driver = keystone.catalog.backends.sql.Catalog
# static, file-based backend (does *NOT* support any management commands) # static, file-based backend (does *NOT* support any management commands)
# driver = keystone.catalog.backends.templated.TemplatedCatalog # driver = keystone.catalog.backends.templated.Catalog
# template_file = default_catalog.templates # template_file = default_catalog.templates

View File

@ -21,6 +21,7 @@ from keystone.catalog import core
from keystone import config from keystone import config
from keystone import exception from keystone import exception
from keystone.openstack.common import log from keystone.openstack.common import log
from keystone.openstack.common import versionutils
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
@ -55,10 +56,7 @@ def parse_templates(template_lines):
return o return o
# TODO(jaypipes): should be templated.Catalog, class Catalog(kvs.Catalog):
# not templated.TemplatedCatalog to be consistent with
# other catalog backends
class TemplatedCatalog(kvs.Catalog):
"""A backend that generates endpoints for the Catalog based on templates. """A backend that generates endpoints for the Catalog based on templates.
It is usually configured via config entries that look like: It is usually configured via config entries that look like:
@ -91,6 +89,7 @@ class TemplatedCatalog(kvs.Catalog):
""" """
def __init__(self, templates=None): def __init__(self, templates=None):
super(Catalog, self).__init__()
if templates: if templates:
self.templates = templates self.templates = templates
else: else:
@ -98,7 +97,6 @@ class TemplatedCatalog(kvs.Catalog):
if not os.path.exists(template_file): if not os.path.exists(template_file):
template_file = CONF.find_file(template_file) template_file = CONF.find_file(template_file)
self._load_templates(template_file) self._load_templates(template_file)
super(TemplatedCatalog, self).__init__()
def _load_templates(self, template_file): def _load_templates(self, template_file):
try: try:
@ -124,3 +122,11 @@ class TemplatedCatalog(kvs.Catalog):
def get_v3_catalog(self, user_id, tenant_id, metadata=None): def get_v3_catalog(self, user_id, tenant_id, metadata=None):
raise exception.NotImplemented() raise exception.NotImplemented()
@versionutils.deprecated(
versionutils.deprecated.ICEHOUSE,
in_favor_of='keystone.catalog.backends.templated.Catalog',
remove_in=+2)
class TemplatedCatalog(Catalog):
pass

View File

@ -1,4 +1,4 @@
# config for TemplatedCatalog, using camelCase because I don't want to do # config for templated.Catalog, using camelCase because I don't want to do
# translations for keystone compat # translations for keystone compat
catalog.RegionOne.identity.publicURL = http://localhost:$(public_port)s/v2.0 catalog.RegionOne.identity.publicURL = http://localhost:$(public_port)s/v2.0
catalog.RegionOne.identity.adminURL = http://localhost:$(admin_port)s/v2.0 catalog.RegionOne.identity.adminURL = http://localhost:$(admin_port)s/v2.0

View File

@ -5,7 +5,7 @@ crypt_strength = 1000
driver = keystone.identity.backends.kvs.Identity driver = keystone.identity.backends.kvs.Identity
[catalog] [catalog]
driver = keystone.catalog.backends.templated.TemplatedCatalog driver = keystone.catalog.backends.templated.Catalog
template_file = default_catalog.templates template_file = default_catalog.templates
[trust] [trust]