aboutsummaryrefslogtreecommitdiffstats
path: root/api/resources/env_action.py
diff options
context:
space:
mode:
Diffstat (limited to 'api/resources/env_action.py')
-rw-r--r--api/resources/env_action.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/api/resources/env_action.py b/api/resources/env_action.py
index 8955f3cb6..2d3496cbc 100644
--- a/api/resources/env_action.py
+++ b/api/resources/env_action.py
@@ -9,15 +9,16 @@
from __future__ import absolute_import
import errno
-import json
import logging
import os
import subprocess
import threading
import time
import uuid
+import glob
from six.moves import configparser
+from oslo_serialization import jsonutils
from api import conf as api_conf
from api.database.handler import AsyncTaskHandler
@@ -67,9 +68,13 @@ def _create_grafana(task_id):
def _create_dashboard():
url = 'http://admin:admin@%s:3000/api/dashboards/db' % api_conf.GATEWAY_IP
- with open('../dashboard/ping_dashboard.json') as dashboard_json:
- data = json.load(dashboard_json)
- HttpClient().post(url, data)
+ path = os.path.join(config.YARDSTICK_REPOS_DIR, 'dashboard',
+ '*dashboard.json')
+
+ for i in sorted(glob.iglob(path)):
+ with open(i) as f:
+ data = jsonutils.load(f)
+ HttpClient().post(url, data)
def _create_data_source():
@@ -248,7 +253,7 @@ def _get_remote_rc_file(rc_file, installer_ip, installer_type):
cmd = [os_fetch_script, '-d', rc_file, '-i', installer_type,
'-a', installer_ip]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
- p.communicate()[0]
+ p.communicate()
if p.returncode != 0:
logger.debug('Failed to fetch credentials from installer')