Use id to identify images from Glance
Name can be empty or match several images Change-Id: I5c5358d0b5fb08d91339acd7c7720db127386f42
This commit is contained in:
parent
68ea2742cc
commit
e40b4ccfae
@ -87,14 +87,14 @@ def get_images():
|
|||||||
'Openstack Exception: %s') % str(e))
|
'Openstack Exception: %s') % str(e))
|
||||||
else:
|
else:
|
||||||
for image in client.images.list():
|
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",
|
metadata = ["architecture", "type", "distribution", "version",
|
||||||
"os_distro", "os_type", "os_version"]
|
"os_distro", "os_type", "os_version"]
|
||||||
if any(key in image.keys() for key in metadata):
|
if any(key in image.keys() for key in metadata):
|
||||||
IMAGES[image_name] = {}
|
IMAGES[image_id] = {}
|
||||||
for key in metadata:
|
for key in metadata:
|
||||||
if key in image.keys():
|
if key in image.keys():
|
||||||
IMAGES[image_name][key] = image[key]
|
IMAGES[image_id][key] = image[key]
|
||||||
|
|
||||||
if not IMAGES:
|
if not IMAGES:
|
||||||
IMAGES = PREDEF_IMAGES
|
IMAGES = PREDEF_IMAGES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user