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:
parent
7a0874f6f6
commit
ed67079d2b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user