summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJing Lu <lvjing5@huawei.com>2017-07-27 05:04:36 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-27 05:04:37 +0000
commitd184d8714e543e4f2497db682154820f7eecf1de (patch)
tree0dd1709c01ff9f34b4d39dad4af50ff6b789234f /api
parentd9b9b8970312e13f798a367439cfc2c333c7fca4 (diff)
parentedbe3568a052da8afd24b6877c4c6fdcc7627ba3 (diff)
Merge "Yardstick GUI & GUI deployment"
Diffstat (limited to 'api')
-rwxr-xr-xapi/api-prepare.sh84
-rw-r--r--api/database/v2/models.py2
-rw-r--r--api/resources/v2/images.py2
-rw-r--r--api/resources/v2/tasks.py3
-rw-r--r--api/resources/v2/testcases.py2
-rw-r--r--api/urls.py3
6 files changed, 9 insertions, 87 deletions
diff --git a/api/api-prepare.sh b/api/api-prepare.sh
deleted file mode 100755
index 7632d9da9..000000000
--- a/api/api-prepare.sh
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright (c) 2016 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
-##############################################################################
-
-: ${YARDSTICK_REPO_DIR:='/home/opnfv/repos/yardstick'}
-
-# generate uwsgi config file
-mkdir -p /etc/yardstick
-uwsgi_config='/etc/yardstick/yardstick.ini'
-if [[ ! -e "${uwsgi_config}" ]];then
-
- cat << EOF > "${uwsgi_config}"
-[uwsgi]
-master = true
-debug = true
-chdir = ${YARDSTICK_REPO_DIR}/api
-module = server
-plugins = python
-processes = 10
-threads = 5
-async = true
-max-requests = 5000
-chmod-socket = 666
-callable = app_wrapper
-enable-threads = true
-close-on-exec = 1
-daemonize= /var/log/yardstick/uwsgi.log
-socket = /var/run/yardstick.sock
-EOF
- if [[ "${YARDSTICK_VENV}" ]];then
- echo "virtualenv = ${YARDSTICK_VENV}" >> "${uwsgi_config}"
- fi
-fi
-
-# nginx config
-nginx_config='/etc/nginx/conf.d/yardstick.conf'
-
-if [[ ! -e "${nginx_config}" ]];then
-
- cat << EOF > "${nginx_config}"
-server {
- listen 5000;
- server_name localhost;
- index index.htm index.html;
- location / {
- include uwsgi_params;
- uwsgi_pass unix:///var/run/yardstick.sock;
- }
-}
-EOF
-fi
-
-# nginx service start when boot
-supervisor_config='/etc/supervisor/conf.d/yardstick.conf'
-
-if [[ ! -e "${supervisor_config}" ]];then
- cat << EOF > "${supervisor_config}"
-[supervisord]
-nodaemon = true
-
-[program:yardstick_nginx]
-user = root
-command = service nginx restart
-autorestart = true
-
-[program:yardstick_uwsgi]
-user = root
-directory = /etc/yardstick
-command = uwsgi -i yardstick.ini
-autorestart = true
-EOF
-fi
-
-# create api log directory
-mkdir -p /var/log/yardstick
-
-# create yardstick.sock for communicating
-touch /var/run/yardstick.sock
diff --git a/api/database/v2/models.py b/api/database/v2/models.py
index 64d49cc9d..1e85559cb 100644
--- a/api/database/v2/models.py
+++ b/api/database/v2/models.py
@@ -31,7 +31,7 @@ class V2Environment(Base):
class V2Openrc(Base):
- __tablename__ = 'V2_openrc'
+ __tablename__ = 'v2_openrc'
id = Column(Integer, primary_key=True)
uuid = Column(String(30))
name = Column(String(30))
diff --git a/api/resources/v2/images.py b/api/resources/v2/images.py
index 8755e5265..8359e105b 100644
--- a/api/resources/v2/images.py
+++ b/api/resources/v2/images.py
@@ -37,6 +37,8 @@ class V2Images(ApiResource):
else:
images = [self.get_info(change_obj_to_dict(i)) for i in images_list]
status = 1 if all(i['status'] == 'ACTIVE' for i in images) else 0
+ if not images:
+ status = 0
return result_handler(consts.API_SUCCESS, {'status': status, 'images': images})
diff --git a/api/resources/v2/tasks.py b/api/resources/v2/tasks.py
index b64f5ef24..885a190c6 100644
--- a/api/resources/v2/tasks.py
+++ b/api/resources/v2/tasks.py
@@ -114,7 +114,8 @@ class V2Task(ApiResource):
if project.tasks:
LOG.info('update tasks in project')
- new_task_list = project.tasks.split(',').remove(task_id)
+ new_task_list = project.tasks.split(',')
+ new_task_list.remove(task_id)
if new_task_list:
new_tasks = ','.join(new_task_list)
else:
diff --git a/api/resources/v2/testcases.py b/api/resources/v2/testcases.py
index ca88e9856..b47a8f6b7 100644
--- a/api/resources/v2/testcases.py
+++ b/api/resources/v2/testcases.py
@@ -25,7 +25,7 @@ class V2Testcases(ApiResource):
def get(self):
param = Param({})
testcase_list = Testcase().list_all(param)
- return result_handler(consts.API_SUCCESS, testcase_list)
+ return result_handler(consts.API_SUCCESS, {'testcases': testcase_list})
def post(self):
return self._dispatch_post()
diff --git a/api/urls.py b/api/urls.py
index 2211348f3..3fef91af8 100644
--- a/api/urls.py
+++ b/api/urls.py
@@ -26,15 +26,18 @@ urlpatterns = [
Url('/api/v2/yardstick/environments/action', 'v2_environments'),
Url('/api/v2/yardstick/environments/<environment_id>', 'v2_environment'),
+ Url('/api/v2/yardstick/openrcs', 'v2_openrcs'),
Url('/api/v2/yardstick/openrcs/action', 'v2_openrcs'),
Url('/api/v2/yardstick/openrcs/<openrc_id>', 'v2_openrc'),
+ Url('/api/v2/yardstick/pods', 'v2_pods'),
Url('/api/v2/yardstick/pods/action', 'v2_pods'),
Url('/api/v2/yardstick/pods/<pod_id>', 'v2_pod'),
Url('/api/v2/yardstick/images', 'v2_images'),
Url('/api/v2/yardstick/images/action', 'v2_images'),
+ Url('/api/v2/yardstick/containers', 'v2_containers'),
Url('/api/v2/yardstick/containers/action', 'v2_containers'),
Url('/api/v2/yardstick/containers/<container_id>', 'v2_container'),