diff options
author | Mark McLoughlin <markmc@redhat.com> | 2012-05-03 21:14:53 +0100 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2012-05-03 21:14:53 +0100 |
commit | f58ca2bdb5dbe20b8d436eefa3480b668c1b6e2d (patch) | |
tree | 320cca334f26cd3c4e9b3fc990c262fb7878826c /keystone/catalog/backends | |
parent | fab58441a2adcd8e88a535c35d3e0e6c459a4468 (diff) | |
download | keystone-f58ca2bdb5dbe20b8d436eefa3480b668c1b6e2d.tar.gz keystone-f58ca2bdb5dbe20b8d436eefa3480b668c1b6e2d.tar.xz keystone-f58ca2bdb5dbe20b8d436eefa3480b668c1b6e2d.zip |
Use ConfigOpts.find_file() to locate catalog template
Fixes bug #983734
Use cfg's new helper method to find the catalog template file. The basic
behavior is "look alongside the config file" with a fall back to the
standard default config paths.
Change-Id: Ia25fefafaa2c387d0207d630e5613389be364628
Diffstat (limited to 'keystone/catalog/backends')
-rw-r--r-- | keystone/catalog/backends/templated.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/keystone/catalog/backends/templated.py b/keystone/catalog/backends/templated.py index 21b4e2f6..12c2a6d4 100644 --- a/keystone/catalog/backends/templated.py +++ b/keystone/catalog/backends/templated.py @@ -14,6 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. +import os.path + from keystone import config from keystone.common import logging from keystone.catalog.backends import kvs @@ -22,7 +24,9 @@ from keystone.catalog.backends import kvs LOG = logging.getLogger(__name__) CONF = config.CONF -config.register_str('template_file', group='catalog') +config.register_str('template_file', + default='default_catalog.templates', + group='catalog') def parse_templates(template_lines): @@ -91,7 +95,10 @@ class TemplatedCatalog(kvs.Catalog): if templates: self.templates = templates else: - self._load_templates(CONF.catalog.template_file) + template_file = CONF.catalog.template_file + if not os.path.exists(template_file): + template_file = CONF.find_file(template_file) + self._load_templates(template_file) super(TemplatedCatalog, self).__init__() def _load_templates(self, template_file): |