Activity log for bug #1270146

Date Who What changed Old value New value Message
2014-01-17 13:07:27 Max Lobur bug added bug
2014-01-17 13:13:36 Max Lobur summary Default value of JSONEncodedDict colums should be { } instead of "{ }" Default value of JSONEncodedDict columns should be { } instead of "{ }"
2014-01-22 15:37:54 OpenStack Infra ironic: status Triaged In Progress
2014-01-29 15:15:17 Max Lobur ironic: importance Medium Low
2014-01-29 15:17:37 Max Lobur description There are a bunch of places where we putting "{ }" as default to the JSONEncodedDict column: https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L473 https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L413 https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L297 https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L295 https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L293 This leads to writing the db value as ' "{ }" ' (https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/models.py#L59) When the object is deserialized from the DB the property becomes string instead of dict, which may cause unexpected errors (due to interfaces mismatch). I propose the following solution: 1. Remove all the places from DB API where JSONEncodedDict default is defined (all mentioned above) 2. Change JSONEncodedDict implementation to def process_bind_param(self, value, dialect): if value is None: value = dict() value = json.dumps(value) return value There are a bunch of places where we putting "{ }" as default to the JSONEncodedDict column: https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L473 https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L413 https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L297 https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L295 https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L293 This leads to writing the db value as ' "{ }" ' (https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/models.py#L59) When the object is deserialized from the DB the property becomes string instead of dict, which may cause unexpected errors (due to interfaces mismatch). Currently we don't have any problems with this because the UOM tries to deserialize the dict value again (https://github.com/openstack/ironic/blob/master/ironic/objects/utils.py#L68-L69) But this looks like a workaround so it's better to fix the original problem This is how it looks like in DB (Note that non-empy extra serialized as expected {} whereas empty extra is "{}") http://paste.openstack.org/show/62103/ I propose the following solution: 1. Remove all the places from DB API where JSONEncodedDict default is defined (all mentioned above) 2. Change JSONEncodedDict implementation to     def process_bind_param(self, value, dialect):         if value is None:             value = dict()         value = json.dumps(value)         return value
2014-02-17 21:46:12 OpenStack Infra ironic: status In Progress Fix Committed
2014-03-05 10:13:46 Thierry Carrez ironic: status Fix Committed Fix Released
2014-03-05 10:13:46 Thierry Carrez ironic: milestone icehouse-3
2014-04-17 15:14:30 Thierry Carrez ironic: milestone icehouse-3 2014.1