summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuique Llorente <ellorent@redhat.com>2018-09-13 13:54:49 +0200
committerQuique Llorente <ellorent@redhat.com>2018-09-13 16:00:40 +0200
commit64b57bfef7bcc45cb127c8d228e53f84a07f8028 (patch)
treee141c8a835ecef3ca69eae70363c99a269ecfa6e
parent54a24d939c36c4b087721d1a660979f612e5b6ec (diff)
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
Notes
Notes (review): Code-Review+1: Raoul Scarazzini <rscarazz@redhat.com> Code-Review+2: Zane Bitter <zbitter@redhat.com> Workflow+1: Zane Bitter <zbitter@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 21 Sep 2018 16:26:58 +0000 Reviewed-on: https://review.openstack.org/602340 Project: openstack/heat-agents Branch: refs/heads/master
-rwxr-xr-xheat-config/bin/heat-config-notify3
1 files changed, 2 insertions, 1 deletions
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):
97 log.error(usage) 97 log.error(usage)
98 return 1 98 return 1
99 99
100 c = json.load(open(conf_file)) 100 with open(conf_file, mode='r') as f:
101 c = json.load(f)
101 102
102 iv = dict((i['name'], i['value']) for i in c['inputs']) 103 iv = dict((i['name'], i['value']) for i in c['inputs'])
103 104