summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/tests/functional/compute/v2/test_server.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/openstackclient/tests/functional/compute/v2/test_server.py b/openstackclient/tests/functional/compute/v2/test_server.py
index 119ef05c..140404de 100644
--- a/openstackclient/tests/functional/compute/v2/test_server.py
+++ b/openstackclient/tests/functional/compute/v2/test_server.py
@@ -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