File horizon-keep-image-properties.patch of Package openstack-dashboard

commit 5e20e7cc11a15820ebc8b829ee485780268eb8e1
Author: Jay Pipes <jaypipes@gmail.com>
Date:   Sun Jun 17 13:21:46 2012 -0400

    Ensure existing image properties are not deleted
    
    Fixes LP #1014226
    
    Passing the X-Glance-Registry-Purge-Props: false
    header to the image_update Glance client method
    prevents previously-set image properties from being
    marked deleted.
    
    Change-Id: I91e927f8c95205cae11bad0d93361f1c9951d62d

Index: horizon-2012.1+git.1344968911.f862d9e/horizon/dashboards/nova/images_and_snapshots/images/forms.py
===================================================================
--- horizon-2012.1+git.1344968911.f862d9e.orig/horizon/dashboards/nova/images_and_snapshots/images/forms.py
+++ horizon-2012.1+git.1344968911.f862d9e/horizon/dashboards/nova/images_and_snapshots/images/forms.py
@@ -83,6 +83,9 @@ class UpdateImageForm(forms.SelfHandling
             meta['properties']['architecture'] = data['architecture']
 
         try:
+            # Ensure we do not delete properties that have already been
+            # set on an image.
+            meta['features'] = {'X-Glance-Registry-Purge-Props': False}
             api.image_update(request, image_id, meta)
             messages.success(request, _('Image was successfully updated.'))
         except:
Index: horizon-2012.1+git.1344968911.f862d9e/horizon/dashboards/nova/images_and_snapshots/images/tests.py
===================================================================
--- horizon-2012.1+git.1344968911.f862d9e.orig/horizon/dashboards/nova/images_and_snapshots/images/tests.py
+++ horizon-2012.1+git.1344968911.f862d9e/horizon/dashboards/nova/images_and_snapshots/images/tests.py
@@ -54,7 +54,8 @@ class ImageViewTests(test.TestCase):
                          'container_format': u'new_format',
                          'is_public': False,
                          'disk_format': u'new_disk_format',
-                         'properties': {}}
+                         'properties': {},
+                         'features': {'X-Glance-Registry-Purge-Props': False}}
 
         self.mox.StubOutWithMock(api, 'image_get_meta')
         self.mox.StubOutWithMock(api, 'image_update')
openSUSE Build Service is sponsored by