summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Waldon <bcwaldon@gmail.com>2012-08-13 10:56:27 -0700
committerBrian Waldon <bcwaldon@gmail.com>2012-08-13 10:56:27 -0700
commita5b8165d7de5edd15a616e2ff97c1f8b72b53e8c (patch)
treea0f74f341e0775315f8c38b6e5e5f4cc953c9824
parent8f0d5c4f2cea6e5dae827b5f728c54dab4a4386b (diff)
downloadpython-glanceclient-0.4.1.tar.gz
Allow 'deleted' to be passed through image update0.4.1
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
-rw-r--r--glanceclient/v1/images.py6
-rw-r--r--tests/v1/test_images.py2
2 files changed, 7 insertions, 1 deletions
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)