Use with statement to enforce file close

We found some race conditions at overcloud deploy, looks like after
running 55-heat-config, the -notify.json files are not there yet.

This review enforce a close() of the file with a with statement

Change-Id: I7d342893d790efa798ff8df379c6942eca5b7ec3
This commit is contained in:
Quique Llorente 2018-09-13 13:54:49 +02:00
parent 54a24d939c
commit 64b57bfef7
1 changed files with 2 additions and 1 deletions

View File

@ -97,7 +97,8 @@ def main(argv=sys.argv, stdin=sys.stdin):
log.error(usage) log.error(usage)
return 1 return 1
c = json.load(open(conf_file)) with open(conf_file, mode='r') as f:
c = json.load(f)
iv = dict((i['name'], i['value']) for i in c['inputs']) iv = dict((i['name'], i['value']) for i in c['inputs'])