diff options
author | Catalina Focsa <catalina.focsa@enea.com> | 2017-05-19 14:12:49 +0200 |
---|---|---|
committer | Catalina Focsa <catalina.focsa@enea.com> | 2017-05-19 14:25:16 +0200 |
commit | 2acf978923acb4c89785331046e293b957e88dfa (patch) | |
tree | 1bfb59d926eb5f82bcec53ebdf04bf65963fd853 | |
parent | e5691c01975e9a3867a17c4fd9b4427bb15f0f10 (diff) |
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 <catalina.focsa@enea.com>
-rw-r--r-- | promise/test/functest/run_tests.py | 24 |
1 files changed, 11 insertions, 13 deletions
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)) |