From 2acf978923acb4c89785331046e293b957e88dfa Mon Sep 17 00:00:00 2001 From: Catalina Focsa Date: Fri, 19 May 2017 14:12:49 +0200 Subject: Fix image name iteration Create a promise image depending on the glance image path. Due to glance image listing returning image names, looking for an image based on an image path is always false, thus its relevant to only look for the glance image name and if it exists to use its ID, if not to create a new image given the promise image name. JIRA: ARMBAND-223 Change-Id: I2d1347807335f2c7e9d62f1a6c75fb48de6cf448 Signed-off-by: Catalina Focsa --- promise/test/functest/run_tests.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'promise/test/functest/run_tests.py') diff --git a/promise/test/functest/run_tests.py b/promise/test/functest/run_tests.py index 17f915b..448231c 100644 --- a/promise/test/functest/run_tests.py +++ b/promise/test/functest/run_tests.py @@ -143,19 +143,17 @@ def main(): logger.info("Upload some OS images if it doesn't exist") - images = {"image_name": GLANCE_IMAGE_NAME, "image_url": GLANCE_IMAGE_PATH} - for image_name, image_url in images.iteritems(): - image_id = os_utils.get_image_id(glance_client, image_name) - - if image_id == '': - logger.info("%s image doesn't exist on glance repo" % image_name) - logger.info("Try downloading this image and upload on glance !") - image_id = os_utils.create_glance_image( - glance_client, GLANCE_IMAGE_NAME, GLANCE_IMAGE_PATH) - - if image_id == '': - logger.error("Failed to create the Glance image...") - return return_code + image_id = os_utils.get_image_id(glance_client, GLANCE_IMAGE_NAME) + + if image_id == '': + logger.info("%s image doesn't exist on glance repo" % GLANCE_IMAGE_NAME) + logger.info("Try downloading this image and upload on glance !") + image_id = os_utils.create_glance_image( + glance_client, GLANCE_IMAGE_NAME, GLANCE_IMAGE_PATH) + + if image_id == '': + logger.error("Failed to create the Glance image...") + return return_code logger.debug("Image '%s' with ID '%s' created successfully." % (PROMISE_IMAGE_NAME, image_id)) -- cgit 1.2.3-korg