From 3b834f25c1d31ef482116344f97b0a1059d9a836 Mon Sep 17 00:00:00 2001 From: Ukesh Kumar Vasudevan Date: Mon, 22 Aug 2016 17:13:00 +0530 Subject: [PATCH] functional tests fail if cirros image not exist The functional tests are looking for a cirros-*uec image and if that isn't found they fail: In the function novaclient/tests/functional/base.py:pick_image, images variable is a generator object which doesn't have '__getitem__' attribute and so the functional test is failing. Change-Id: I32b05ff6f2c7501eff04fa9f180eecf3099389ab Closes-Bug: 1615594 --- novaclient/tests/functional/base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/novaclient/tests/functional/base.py b/novaclient/tests/functional/base.py index 1bd2e809a..febe1669a 100644 --- a/novaclient/tests/functional/base.py +++ b/novaclient/tests/functional/base.py @@ -60,7 +60,9 @@ def pick_flavor(flavors): def pick_image(images): + firstImage = None for image in images: + firstImage = firstImage or image if image.name.startswith('cirros') and ( image.name.endswith('-uec') or image.name.endswith('-disk.img')): @@ -68,8 +70,8 @@ def pick_image(images): # We didn't find the specific cirros image we'd like to use, so just use # the first available. - if images: - return images[0] + if firstImage: + return firstImage raise NoImageException()