diff options
Diffstat (limited to 'api/resources/v2')
-rw-r--r-- | api/resources/v2/containers.py | 2 | ||||
-rw-r--r-- | api/resources/v2/environments.py | 8 | ||||
-rw-r--r-- | api/resources/v2/images.py | 10 | ||||
-rw-r--r-- | api/resources/v2/openrcs.py | 8 | ||||
-rw-r--r-- | api/resources/v2/pods.py | 8 | ||||
-rw-r--r-- | api/resources/v2/projects.py | 8 | ||||
-rw-r--r-- | api/resources/v2/tasks.py | 11 | ||||
-rw-r--r-- | api/resources/v2/testcases.py | 10 | ||||
-rw-r--r-- | api/resources/v2/testsuites.py | 8 |
9 files changed, 70 insertions, 3 deletions
diff --git a/api/resources/v2/containers.py b/api/resources/v2/containers.py index ce7130376..66dc94120 100644 --- a/api/resources/v2/containers.py +++ b/api/resources/v2/containers.py @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 diff --git a/api/resources/v2/environments.py b/api/resources/v2/environments.py index e4679b0d6..f021a3c5a 100644 --- a/api/resources/v2/environments.py +++ b/api/resources/v2/environments.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. +# +# 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 +############################################################################## import uuid import logging diff --git a/api/resources/v2/images.py b/api/resources/v2/images.py index 701818493..8359e105b 100644 --- a/api/resources/v2/images.py +++ b/api/resources/v2/images.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. +# +# 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 +############################################################################## import logging import subprocess import threading @@ -29,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/openrcs.py b/api/resources/v2/openrcs.py index 5f3b9382f..cb506d0e8 100644 --- a/api/resources/v2/openrcs.py +++ b/api/resources/v2/openrcs.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. +# +# 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 +############################################################################## import uuid import logging import re diff --git a/api/resources/v2/pods.py b/api/resources/v2/pods.py index ebc1312da..f2316d353 100644 --- a/api/resources/v2/pods.py +++ b/api/resources/v2/pods.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. +# +# 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 +############################################################################## import uuid import yaml import logging diff --git a/api/resources/v2/projects.py b/api/resources/v2/projects.py index 376cf1a37..2ff61d0fe 100644 --- a/api/resources/v2/projects.py +++ b/api/resources/v2/projects.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. +# +# 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 +############################################################################## import uuid import logging diff --git a/api/resources/v2/tasks.py b/api/resources/v2/tasks.py index 9790d7640..885a190c6 100644 --- a/api/resources/v2/tasks.py +++ b/api/resources/v2/tasks.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. +# +# 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 +############################################################################## import uuid import logging from datetime import datetime @@ -106,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 81b4aa88c..b47a8f6b7 100644 --- a/api/resources/v2/testcases.py +++ b/api/resources/v2/testcases.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. +# +# 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 +############################################################################## import logging import errno import os @@ -17,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/resources/v2/testsuites.py b/api/resources/v2/testsuites.py index ee942eff9..56ad47375 100644 --- a/api/resources/v2/testsuites.py +++ b/api/resources/v2/testsuites.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd. +# +# 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 +############################################################################## import os import errno import logging |