From e40b4ccfaed498cab4875c0d793fbfc57bcf8f01 Mon Sep 17 00:00:00 2001 From: Mathieu Velten Date: Thu, 23 Mar 2017 16:05:34 +0100 Subject: [PATCH] Use id to identify images from Glance Name can be empty or match several images Change-Id: I5c5358d0b5fb08d91339acd7c7720db127386f42 --- translator/common/images.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translator/common/images.py b/translator/common/images.py index d9b8818a..a2ac6e5e 100755 --- a/translator/common/images.py +++ b/translator/common/images.py @@ -87,14 +87,14 @@ def get_images(): 'Openstack Exception: %s') % str(e)) else: for image in client.images.list(): - image_name = image.name.encode('ascii', 'ignore') + image_id = image.id.encode('ascii', 'ignore') metadata = ["architecture", "type", "distribution", "version", "os_distro", "os_type", "os_version"] if any(key in image.keys() for key in metadata): - IMAGES[image_name] = {} + IMAGES[image_id] = {} for key in metadata: if key in image.keys(): - IMAGES[image_name][key] = image[key] + IMAGES[image_id][key] = image[key] if not IMAGES: IMAGES = PREDEF_IMAGES