diff --git a/keystone/catalog/backends/templated.py b/keystone/catalog/backends/templated.py index 0f28d608d7..780bc42898 100644 --- a/keystone/catalog/backends/templated.py +++ b/keystone/catalog/backends/templated.py @@ -100,7 +100,8 @@ class Catalog(core.Driver): def _load_templates(self, template_file): try: - self.templates = parse_templates(open(template_file)) + with open(template_file) as f: + self.templates = parse_templates(f) except IOError: LOG.critical(_LC('Unable to open template file %s'), template_file) raise