summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJing Lu <lvjing5@huawei.com>2016-12-13 06:27:55 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-12-13 06:27:55 +0000
commit9297d61e95de1d03f3bd98e201f8bd29beed0982 (patch)
treec799797454b0721ce8aadaa08be53be850505519
parent3c3ac5d9e89af36bb609017e69f6d03b52d8b251 (diff)
parent5cd8d1c468c3995069e2e90349c9a8f432b2ec44 (diff)
Merge "env: convert file open to context manager"
-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)