Fix image selection in server function tests
The image selection has been affected by Cirros image changes in DevStack, make the logic moe robust and convert it to JSON. The conversion for the remainder of the file will follow. Change-Id: I8f3318f55ed79d617c3594142f0c086e2bd1a7b1
This commit is contained in:
parent
3b562ffa90
commit
ef1a86a802
@ -37,13 +37,18 @@ class ServerTests(base.TestCase):
|
||||
|
||||
@classmethod
|
||||
def get_image(cls):
|
||||
# NOTE(rtheis): Get cirros image since functional tests may
|
||||
# create other images.
|
||||
images = cls.openstack('image list -c Name -f value').split('\n')
|
||||
# NOTE(rtheis): Get first Cirros image since functional tests may
|
||||
# create other images. Image may be named '-uec' or
|
||||
# '-disk'.
|
||||
cmd_output = json.loads(cls.openstack(
|
||||
"image list -f json "
|
||||
))
|
||||
server_image = None
|
||||
for image in images:
|
||||
if image.startswith('cirros-') and image.endswith('-uec'):
|
||||
server_image = image
|
||||
for image in cmd_output:
|
||||
if (image['Name'].startswith('cirros-') and
|
||||
(image['Name'].endswith('-uec') or
|
||||
image['Name'].endswith('-disk'))):
|
||||
server_image = image['Name']
|
||||
break
|
||||
return server_image
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user