From 3f7171dc1445f0647f15a735e5f4b55a986068e6 Mon Sep 17 00:00:00 2001 From: imacdonn Date: Fri, 14 Sep 2018 23:25:11 +0000 Subject: Embed validation data when adding location Add support for embedding of checksum, os_hash_algo and os_hash_value when adding a location to an image. Depends-On: https://review.openstack.org/597648 Change-Id: Ibbe2f2bb226f52cc6b2ab591913b1797d2b086c0 --- glanceclient/v2/images.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'glanceclient/v2/images.py') diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py index be804a2..296e2cc 100644 --- a/glanceclient/v2/images.py +++ b/glanceclient/v2/images.py @@ -381,7 +381,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 @@ -390,10 +390,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 -- cgit v1.2.1