Code review comment for lp:~jshepher/glance/lp813291

Revision history for this message
Justin Shepherd (jshepher) wrote :

Here are the other solutions i tried:

#2

=== modified file 'glance/registry/db/api.py'
--- glance/registry/db/api.py 2011-07-20 04:11:54 +0000
+++ glance/registry/db/api.py 2011-07-20 04:14:00 +0000
@@ -92,10 +92,10 @@

 def image_create(context, values):
     """Create an image from the values dictionary."""
+ if 'id' in values:
+ return _image_update(context, values, values['id'], False)
+ else:
+ return _image_update(context, values, None, False)

 def image_update(context, image_id, values, purge_props=False):

====================================================================================================

#3

=== modified file 'glance/registry/db/api.py'
--- glance/registry/db/api.py 2011-07-20 04:11:54 +0000
+++ glance/registry/db/api.py 2011-07-20 04:15:01 +0000
@@ -258,6 +255,9 @@
         # not a dict.
         properties = values.pop('properties', {})

+ if 'id' in values:
+ image_id = values['id']
+
         if image_id:
             image_ref = image_get(context, image_id, session=session)
         else:

« Back to merge proposal