summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-10-01 05:52:39 +0000
committerGerrit Code Review <review@openstack.org>2020-10-01 05:52:39 +0000
commiteb5416a257f8b7639a7786961b43c20e8efae007 (patch)
tree33fc17836f9e5a457f387e955aa6fb09210564d6 /openstackclient/compute
parent3902efc292e9c7e8859a841a3d5f4e9644b2e8c9 (diff)
parentfbd2c00b8999202917671bcdb39298eb39c3ad47 (diff)
downloadpython-openstackclient-eb5416a257f8b7639a7786961b43c20e8efae007.tar.gz
Merge "Fix --image-property option in 'create server'"
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/server.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index 69756ae2..1d1fc741 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -765,19 +765,27 @@ class CreateServer(command.ShowOne):
images_matched = []
for img in image_list:
img_dict = {}
+
# exclude any unhashable entries
- for key, value in img.items():
+ img_dict_items = list(img.items())
+ if img.properties:
+ img_dict_items.extend(list(img.properties.items()))
+ for key, value in img_dict_items:
try:
set([key, value])
except TypeError:
+ if key != 'properties':
+ LOG.debug('Skipped the \'%s\' attribute. '
+ 'That cannot be compared. '
+ '(image: %s, value: %s)',
+ key, img.id, value)
pass
else:
img_dict[key] = value
+
if all(k in img_dict and img_dict[k] == v
for k, v in wanted_properties.items()):
images_matched.append(img)
- else:
- return []
return images_matched
images = _match_image(image_client, parsed_args.image_property)