Remove location check from V2 client

Glance client has a custom check that generates exception if
location has not been returned by image-get request.
This check should on server side and it should be managed by
policy rules when do location-add action.
That also allows to increase possibility of migrating Heat
to v2[1].

NOTE: After this patch, we'll raise a HTTPBadRequest from
server side instead of HTTPConflict when a user adds a
duplicate location.

[1]: https://review.openstack.org/#/c/240450/

Co-Authored-By: wangxiyuan <wangxiyuan@huawei.com>

Change-Id: I778ad2a97805b4d85eb0430c603c27a0a1c148e0
Closes-bug: #1493026
This commit is contained in:
kairat_kushaev
2015-11-06 18:16:30 +03:00
committed by wangxiyuan
parent 2973489622
commit cea67763c9
2 changed files with 8 additions and 19 deletions
-6
View File
@@ -305,12 +305,6 @@ class Controller(object):
:param metadata: Metadata associated with the location.
:returns: The updated image
"""
image = self._get_image_with_locations_or_fail(image_id)
url_list = [l['url'] for l in image.locations]
if url in url_list:
err_str = 'A location entry at %s already exists' % url
raise exc.HTTPConflict(err_str)
add_patch = [{'op': 'add', 'path': '/locations/-',
'value': {'url': url, 'metadata': metadata}}]
self._send_image_update_request(image_id, add_patch)