Uses open context manager for templated catalogs

Python 3 warns that the file isn't being properly closed. This patch
stops that warning from happening by properly closing the file.

Change-Id: I7dcb08e11dfe4ba679bcde645284b24f8cb126fd
bp: python3
This commit is contained in:
David Stanek 2016-01-19 16:31:15 +00:00
parent 7a0874f6f6
commit ed67079d2b

View File

@ -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