Accept glance image ID in addition to name

Add a check to accept the image ID if provided. Currently only the
name is checked.

Change-Id: I7c02079debd13c743b84e91ddd226a4b365f6b77
Closes-Bug: 1710717
This commit is contained in:
Bob Fournier 2017-08-29 18:27:21 -04:00
parent 923658a720
commit 896b2492ee
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,3 @@
---
fixes:
- Accept the glance image ID in addition to the name.

View File

@ -53,7 +53,8 @@ def _upload_file(glanceclient, name, path, disk_format, type_name,
disk_format=disk_format)
image = None
for img in images:
if img['name'] == name and img['disk_format'] == disk_format:
if ((img['name'] == name or img['id'] == name) and
img['disk_format'] == disk_format):
image = img
if not image:
raise exceptions.NotFound("No image found")