Merge "replace yaml.load with yaml.safe_load"
[yardstick.git] / api / resources / v2 / images.py
index 7018184..8359e10 100644 (file)
@@ -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})