From a5b8165d7de5edd15a616e2ff97c1f8b72b53e8c Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Mon, 13 Aug 2012 10:56:27 -0700 Subject: [PATCH] Allow 'deleted' to be passed through image update The legacy client allowed users to pass 'deleted' through an update call. This is breaking some clients of this library because they expect to be be able to still do that. Fixes bug 1036315 Change-Id: I9ae20a5e4579240c7d5e86316d6d1e927755dbf5 --- glanceclient/v1/images.py | 6 +++++- tests/v1/test_images.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/glanceclient/v1/images.py b/glanceclient/v1/images.py index c77d280..a4b759a 100644 --- a/glanceclient/v1/images.py +++ b/glanceclient/v1/images.py @@ -24,7 +24,11 @@ from glanceclient.common import utils UPDATE_PARAMS = ('name', 'disk_format', 'container_format', 'min_disk', 'min_ram', 'owner', 'size', 'is_public', 'protected', - 'location', 'checksum', 'copy_from', 'properties') + 'location', 'checksum', 'copy_from', 'properties', + #NOTE(bcwaldon: an attempt to update 'deleted' will be + # ignored, but we need to support it for backwards- + # compatibility with the legacy client library + 'deleted') CREATE_PARAMS = UPDATE_PARAMS + ('id',) diff --git a/tests/v1/test_images.py b/tests/v1/test_images.py index 6478303..6f258e6 100644 --- a/tests/v1/test_images.py +++ b/tests/v1/test_images.py @@ -362,6 +362,7 @@ class ImageManagerTest(unittest.TestCase): 'min_disk': 10, 'copy_from': 'http://example.com', 'properties': {'a': 'b', 'c': 'd'}, + 'deleted': False, } image = self.mgr.update('1', **fields) expect_hdrs = { @@ -375,6 +376,7 @@ class ImageManagerTest(unittest.TestCase): 'x-glance-api-copy-from': 'http://example.com', 'x-image-meta-property-a': 'b', 'x-image-meta-property-c': 'd', + 'x-image-meta-deleted': 'False', } expect = [('PUT', '/v1/images/1', expect_hdrs, None)] self.assertEqual(self.api.calls, expect)