summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUkesh Kumar Vasudevan <ukeshkumar@gmail.com>2016-08-19 18:10:19 +0530
committerMatt Riedemann <mriedem@us.ibm.com>2016-08-20 08:40:13 -0400
commit5bdee97f4843de36669e25aa27874c93451fe05a (patch)
tree32e0bc6059d1f77dc8a26be861179459ea387e96
parent5744ac130fac2634529b9a0088f4f093341ae1a4 (diff)
downloadpython-novaclient-5bdee97f4843de36669e25aa27874c93451fe05a.tar.gz
Pick first image if can't find the specific image
In pick_image method to just pick the first image it finds if it can't find the specific cirros-*uec image. Also look for the -disk.img since devstack is changing the default image in: Id65ebae73b28da7185cb349b714b659af51ef77f Change-Id: I0e4c38a9e0ae25a922f6b0e09f3f2531f49c88c9 Closes-Bug: 1614118 (cherry picked from commit 01de5a9f68ad474e9bfa213ffeb3501066a52ebd)
-rw-r--r--novaclient/tests/functional/base.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/novaclient/tests/functional/base.py b/novaclient/tests/functional/base.py
index d51a19d7..a7217693 100644
--- a/novaclient/tests/functional/base.py
+++ b/novaclient/tests/functional/base.py
@@ -44,8 +44,16 @@ def pick_flavor(flavors):
def pick_image(images):
for image in images:
- if image.name.startswith('cirros') and image.name.endswith('-uec'):
+ if image.name.startswith('cirros') and (
+ image.name.endswith('-uec') or
+ image.name.endswith('-disk.img')):
return image
+
+ # We didn't find the specific cirros image we'd like to use, so just use
+ # the first available.
+ if images:
+ return images[0]
+
raise NoImageException()