Use openstack-images-v2.1-json-patch for update method
image.patch returns a JSON schema Draft 10 (application/openstack-images-v2.1-json-patch) while the glaceclient update method specify a Content-Type header application/openstack-images-v2.0-json-patch with correspond to a JSON schemea Draft 4. Fixes bug 1206095 Change-Id: I8c5a96f0e117a81b5b527a96ef45758fc69b518d
This commit is contained in:
		@@ -147,7 +147,7 @@ class Controller(object):
 | 
			
		||||
                delattr(image, key)
 | 
			
		||||
 | 
			
		||||
        url = '/v2/images/%s' % image_id
 | 
			
		||||
        hdrs = {'Content-Type': 'application/openstack-images-v2.0-json-patch'}
 | 
			
		||||
        hdrs = {'Content-Type': 'application/openstack-images-v2.1-json-patch'}
 | 
			
		||||
        self.http_client.raw_request('PATCH', url,
 | 
			
		||||
                                     headers=hdrs,
 | 
			
		||||
                                     body=image.patch)
 | 
			
		||||
 
 | 
			
		||||
@@ -437,7 +437,7 @@ class TestController(testtools.TestCase):
 | 
			
		||||
        params = {'name': 'pong'}
 | 
			
		||||
        image = self.controller.update(image_id, **params)
 | 
			
		||||
        expect_hdrs = {
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.0-json-patch',
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.1-json-patch',
 | 
			
		||||
        }
 | 
			
		||||
        expect_body = '[{"path": "/name", "value": "pong", "op": "replace"}]'
 | 
			
		||||
        expect = [
 | 
			
		||||
@@ -456,7 +456,7 @@ class TestController(testtools.TestCase):
 | 
			
		||||
        params = {'finn': 'human'}
 | 
			
		||||
        image = self.controller.update(image_id, **params)
 | 
			
		||||
        expect_hdrs = {
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.0-json-patch',
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.1-json-patch',
 | 
			
		||||
        }
 | 
			
		||||
        expect_body = '[{"path": "/finn", "value": "human", "op": "add"}]'
 | 
			
		||||
        expect = [
 | 
			
		||||
@@ -475,7 +475,7 @@ class TestController(testtools.TestCase):
 | 
			
		||||
        remove_props = ['barney']
 | 
			
		||||
        image = self.controller.update(image_id, remove_props)
 | 
			
		||||
        expect_hdrs = {
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.0-json-patch',
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.1-json-patch',
 | 
			
		||||
        }
 | 
			
		||||
        expect_body = '[{"path": "/barney", "op": "remove"}]'
 | 
			
		||||
        expect = [
 | 
			
		||||
@@ -496,7 +496,7 @@ class TestController(testtools.TestCase):
 | 
			
		||||
        remove_props = ['barney']
 | 
			
		||||
        image = self.controller.update(image_id, remove_props, **params)
 | 
			
		||||
        expect_hdrs = {
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.0-json-patch',
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.1-json-patch',
 | 
			
		||||
        }
 | 
			
		||||
        expect_body = '[{"path": "/barney", "value": "miller", ' \
 | 
			
		||||
                      '"op": "replace"}]'
 | 
			
		||||
@@ -518,7 +518,7 @@ class TestController(testtools.TestCase):
 | 
			
		||||
        remove_props = ['finn']
 | 
			
		||||
        image = self.controller.update(image_id, remove_props, **params)
 | 
			
		||||
        expect_hdrs = {
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.0-json-patch',
 | 
			
		||||
            'Content-Type': 'application/openstack-images-v2.1-json-patch',
 | 
			
		||||
        }
 | 
			
		||||
        expect_body = '[{"path": "/finn", "value": "human", "op": "add"}]'
 | 
			
		||||
        expect = [
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user