summaryrefslogtreecommitdiff
path: root/glanceclient/v2/images.py
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-03-07 16:46:55 +0000
committerGerrit Code Review <review@openstack.org>2019-03-07 16:46:55 +0000
commit8b9dc5635e38ad451556aca258ca4fc85fb310c5 (patch)
tree3008a2b6df9d5d4f747f344afa3e6993d8df3af6 /glanceclient/v2/images.py
parent68adb8ccb457cc6383e2cf74cde7cae5af812ff2 (diff)
parent3f7171dc1445f0647f15a735e5f4b55a986068e6 (diff)
downloadpython-glanceclient-8b9dc5635e38ad451556aca258ca4fc85fb310c5.tar.gz
Merge "Embed validation data when adding location"
Diffstat (limited to 'glanceclient/v2/images.py')
-rw-r--r--glanceclient/v2/images.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py
index 09d46b9..5252ee3 100644
--- a/glanceclient/v2/images.py
+++ b/glanceclient/v2/images.py
@@ -432,7 +432,7 @@ class Controller(object):
data=json.dumps(patch_body))
return (resp, body), resp
- def add_location(self, image_id, url, metadata):
+ def add_location(self, image_id, url, metadata, validation_data=None):
"""Add a new location entry to an image's list of locations.
It is an error to add a URL that is already present in the list of
@@ -441,10 +441,13 @@ class Controller(object):
:param image_id: ID of image to which the location is to be added.
:param url: URL of the location to add.
:param metadata: Metadata associated with the location.
+ :param validation_data: Validation data for the image.
:returns: The updated image
"""
add_patch = [{'op': 'add', 'path': '/locations/-',
'value': {'url': url, 'metadata': metadata}}]
+ if validation_data:
+ add_patch[0]['value']['validation_data'] = validation_data
response = self._send_image_update_request(image_id, add_patch)
# Get request id from the above update request and pass the same to
# following get request