From 64b57bfef7bcc45cb127c8d228e53f84a07f8028 Mon Sep 17 00:00:00 2001 From: Quique Llorente Date: Thu, 13 Sep 2018 13:54:49 +0200 Subject: [PATCH] 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 --- heat-config/bin/heat-config-notify | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/heat-config/bin/heat-config-notify b/heat-config/bin/heat-config-notify index b2b35f2..7e19f47 100755 --- a/heat-config/bin/heat-config-notify +++ b/heat-config/bin/heat-config-notify @@ -97,7 +97,8 @@ def main(argv=sys.argv, stdin=sys.stdin): log.error(usage) 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'])