summaryrefslogtreecommitdiffstats
path: root/api/actions
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2016-12-07 00:26:16 -0500
committerRoss Brattain <ross.b.brattain@intel.com>2016-12-07 00:26:16 -0500
commit5cd8d1c468c3995069e2e90349c9a8f432b2ec44 (patch)
treea3101a5b4bddb7c3683528dfb2738fac5a7ac79d /api/actions
parent6d8123f78a63292cf8be65bf7a347a5867bd5220 (diff)
env: convert file open to context manager
always use context managers to open file Change-Id: I2c894ea87a94789edbed4a4da1fa906b28556664 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'api/actions')
-rw-r--r--api/actions/env.py3
1 files changed, 2 insertions, 1 deletions
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)