Merge "Handle NULL value for service.extra in migration 066"
This commit is contained in:
commit
1293335e48
|
@ -22,7 +22,11 @@ def upgrade(migrate_engine):
|
|||
services = list(service_table.select().execute())
|
||||
|
||||
for service in services:
|
||||
extra_dict = jsonutils.loads(service.extra)
|
||||
if service.extra is not None:
|
||||
extra_dict = jsonutils.loads(service.extra)
|
||||
else:
|
||||
extra_dict = {}
|
||||
|
||||
# Skip records where service is not null
|
||||
if extra_dict.get('name') is not None:
|
||||
continue
|
||||
|
|
|
@ -512,6 +512,10 @@ class SqlUpgradeTests(SqlMigrateBase):
|
|||
random_attr_name_empty, random_attr_name_none_str),
|
||||
]
|
||||
|
||||
# NOTE(viktors): Add a service with empty extra field
|
||||
self.insert_dict(session, 'service',
|
||||
{'id': uuid.uuid4().hex, 'type': uuid.uuid4().hex})
|
||||
|
||||
session.close()
|
||||
self.upgrade(66)
|
||||
session = self.Session()
|
||||
|
|
Loading…
Reference in New Issue