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
Here are the other solutions i tried:
#2
=== modified file 'glance/ registry/ db/api. py' registry/ db/api. py 2011-07-20 04:11:54 +0000 registry/ db/api. py 2011-07-20 04:14:00 +0000
--- glance/
+++ glance/
@@ -92,10 +92,10 @@
def image_create( context, values): update( context, values, values['id'], False) update( context, values, None, False)
"""Create an image from the values dictionary."""
+ if 'id' in values:
+ return _image_
+ else:
+ return _image_
def image_update( context, image_id, values, purge_props=False):
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ==
#3
=== modified file 'glance/ registry/ db/api. py' registry/ db/api. py 2011-07-20 04:11:54 +0000 registry/ db/api. py 2011-07-20 04:15:01 +0000 pop('properties ', {})
--- glance/
+++ glance/
@@ -258,6 +255,9 @@
# not a dict.
properties = values.
+ if 'id' in values:
image_ ref = image_get(context, image_id, session=session)
+ image_id = values['id']
+
if image_id:
else: