Skip to content

Commit c66a03b

Browse files
committed
Don't rely on SQLAlchemy collections magically initializing __dict__
The behavior of accessing "foo.some_collection" mutating __dict__ is going away. You still get an empty list back but the assumptions made in Nova here go beyond that including that security group tests are expecting "rules=[]" to be in `__dict__` which will not be the case. Set an empty list explicitly here. Related SQLAlchemy gerrit: https://gerrit.sqlalchemy.org/#/c/sqlalchemy/sqlalchemy/+/1283/ Oslo.db discussion: https://bugs.launchpad.net/oslo.db/+bug/1830504 Change-Id: I986e069a65b608799b5074829fa796c6c4b98da8
1 parent 37ccd7e commit c66a03b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nova/db/sqlalchemy/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3861,7 +3861,7 @@ def security_group_create(context, values):
38613861
security_group_ref = models.SecurityGroup()
38623862
# FIXME(devcamcar): Unless I do this, rules fails with lazy load exception
38633863
# once save() is called. This will get cleaned up in next orm pass.
3864-
security_group_ref.rules
3864+
security_group_ref.rules = []
38653865
security_group_ref.update(values)
38663866
try:
38673867
with get_context_manager(context).writer.savepoint.using(context):

0 commit comments

Comments
 (0)