summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/resources/env_action.py18
-rw-r--r--api/swagger/docs/release_action.yaml8
-rw-r--r--api/swagger/docs/results.yaml8
-rw-r--r--api/swagger/docs/testsuites_action.yaml8
-rw-r--r--api/utils/common.py2
-rw-r--r--api/utils/influx.py2
6 files changed, 38 insertions, 8 deletions
diff --git a/api/resources/env_action.py b/api/resources/env_action.py
index 8955f3cb6..ea94bc123 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
@@ -26,6 +27,7 @@ from api.utils.common import result_handler
from docker import Client
from yardstick.common import constants as config
from yardstick.common import utils as yardstick_utils
+from yardstick.common import openstack_utils
from yardstick.common.httpClient import HttpClient
logger = logging.getLogger(__name__)
@@ -67,9 +69,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 +254,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')
@@ -258,7 +264,7 @@ def _get_remote_rc_file(rc_file, installer_ip, installer_type):
def _append_external_network(rc_file):
- neutron_client = yardstick_utils.get_neutron_client()
+ neutron_client = openstack_utils.get_neutron_client()
networks = neutron_client.list_networks()['networks']
try:
ext_network = next(n['name'] for n in networks if n['router:external'])
diff --git a/api/swagger/docs/release_action.yaml b/api/swagger/docs/release_action.yaml
index 7bfe5e647..0e08e582f 100644
--- a/api/swagger/docs/release_action.yaml
+++ b/api/swagger/docs/release_action.yaml
@@ -1,3 +1,11 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
TestCases Actions
This API may offer many actions, including runTestCase
diff --git a/api/swagger/docs/results.yaml b/api/swagger/docs/results.yaml
index 7bdab3eb6..00b159003 100644
--- a/api/swagger/docs/results.yaml
+++ b/api/swagger/docs/results.yaml
@@ -1,3 +1,11 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
Query task result data
This api offer the interface to get the result data via task_id
diff --git a/api/swagger/docs/testsuites_action.yaml b/api/swagger/docs/testsuites_action.yaml
index ebf01e4ec..ca8d22738 100644
--- a/api/swagger/docs/testsuites_action.yaml
+++ b/api/swagger/docs/testsuites_action.yaml
@@ -1,3 +1,11 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
TestSuites Actions
This API may offer many actions, including runTestSuite
diff --git a/api/utils/common.py b/api/utils/common.py
index 1c800ce49..3e9bf8f8b 100644
--- a/api/utils/common.py
+++ b/api/utils/common.py
@@ -33,7 +33,7 @@ def get_command_list(command_list, opts, args):
command_list.append(args)
- command_list.extend(('--{}'.format(k) for k in opts if 'task-args' != k))
+ command_list.extend(('--{}'.format(k) for k in opts if k != 'task-args'))
task_args = opts.get('task-args', '')
if task_args:
diff --git a/api/utils/influx.py b/api/utils/influx.py
index 275c63a24..08996b9c9 100644
--- a/api/utils/influx.py
+++ b/api/utils/influx.py
@@ -24,7 +24,7 @@ def get_data_db_client():
try:
parser.read(conf.OUTPUT_CONFIG_FILE_PATH)
- if 'influxdb' != parser.get('DEFAULT', 'dispatcher'):
+ if parser.get('DEFAULT', 'dispatcher') != 'influxdb':
raise RuntimeError
return _get_client(parser)