yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #73675
[Bug 1775863] Re: Cannot save a RequestSpec object if nothing changed
Reviewed: https://review.openstack.org/573768
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=08fb09e878dcaedbb446e18502a6172fa4d43121
Submitter: Zuul
Branch: master
commit 08fb09e878dcaedbb446e18502a6172fa4d43121
Author: Balazs Gibizer <balazs.gibizer@xxxxxxxxxxxx>
Date: Fri Jun 8 17:57:07 2018 +0200
Fix unbound local when saving an unchanged RequestSpec
RequestSpec._get_update_primitives() tried to return the unitialized
db_updates field when the object has no changes. This patch initalizes
that local to None and handles that None in create() and save() where
the RequestSpec._get_update_primitives() is called.
Change-Id: Iad256079945bf8b5745ebdcc393c55115dbcab75
Closes-Bug: #1775863
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1775863
Title:
Cannot save a RequestSpec object if nothing changed
Status in OpenStack Compute (nova):
Fix Released
Bug description:
If a RequestSpec.save() is called on an object that has no changed
field the code blows up with UnboundLocalError:
File "nova/tests/unit/objects/test_request_spec.py", line 622, in test_save_does_not_persist_requested_resources
req_obj.save()
File "/mnt/ssd/ebalgib/nova/py27/.tox/py27/local/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 226, in wrapper
return fn(self, *args, **kwargs)
File "nova/objects/request_spec.py", line 588, in save
updates = self._get_update_primitives()
File "nova/objects/request_spec.py", line 561, in _get_update_primitives
return db_updates
UnboundLocalError: local variable 'db_updates' referenced before assignment
It is because the db_updates local is only initialized if there is something to update but returned regardless
https://github.com/openstack/nova/blob/master/nova/objects/request_spec.py#L518
https://github.com/openstack/nova/blob/master/nova/objects/request_spec.py#L532
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1775863/+subscriptions
References