From 5cd8d1c468c3995069e2e90349c9a8f432b2ec44 Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Wed, 7 Dec 2016 00:26:16 -0500 Subject: env: convert file open to context manager always use context managers to open file Change-Id: I2c894ea87a94789edbed4a4da1fa906b28556664 Signed-off-by: Ross Brattain --- api/actions/env.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/actions/env.py b/api/actions/env.py index 78f9b72ed..fa0f95d90 100644 --- a/api/actions/env.py +++ b/api/actions/env.py @@ -53,7 +53,8 @@ def _create_grafana(): def _create_dashboard(): url = 'http://admin:admin@%s:3000/api/dashboards/db' % api_conf.GATEWAY_IP - data = json.load(file('../dashboard/ping_dashboard.json')) + with open('../dashboard/ping_dashboard.json') as dashboard_json: + data = json.load(dashboard_json) HttpClient().post(url, data) -- cgit 1.2.3-korg