yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #91827
[Bug 2017784] Re: Incorrect use of "db_api.CONTEXT_*" decorators
Reviewed: https://review.opendev.org/c/openstack/neutron/+/881569
Committed: https://opendev.org/openstack/neutron/commit/4e27e27ae2423126202d22cdb044a3320b96089b
Submitter: "Zuul (22348)"
Branch: master
commit 4e27e27ae2423126202d22cdb044a3320b96089b
Author: Rodolfo Alonso Hernandez <ralonsoh@xxxxxxxxxx>
Date: Sun Apr 23 08:21:35 2023 +0200
Replace context decorators with context managers
The context decorator needs to have the "context" parameter in the
first position or the first argument must be "self" or "cls",
followed by the "context" object.
Closes-Bug: #2017784
Change-Id: Ib80f7c72e78854226b227e354792320c78fed5d0
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2017784
Title:
Incorrect use of "db_api.CONTEXT_*" decorators
Status in neutron:
Fix Released
Bug description:
The ``CONTEXT_READER`` and ``CONTEXT_WRITER`` decorators inherit from
``_TransactionContextManager`` [1]. The decorator class call retrieves
the context object from the *args or **kwargs. This decorator is
expecting the "context" object to be the first of the positional
parameters, except if the method belongs to a class where the first
parameter will be "self" or "cls" [2].
However, we are using the decorator in some methods that doesn't
belong to a class and where the first parameter is not one these two.
For example [3].
This is being reported in the tempest tests [4] with the message "ORM
session ...".
[1]https://github.com/openstack/oslo.db/blob/a7c03ba9de6f9a98aa5c36a67e1ecfab77acde9a/oslo_db/sqlalchemy/enginefacade.py#L758
[2]https://github.com/openstack/oslo.db/blob/a7c03ba9de6f9a98aa5c36a67e1ecfab77acde9a/oslo_db/sqlalchemy/enginefacade.py#L1007
[3]https://github.com/openstack/neutron/blob/5cd0388eb7cac84fc1aaa425184bf4af67ed0608/neutron/objects/db/api.py#L34
[4]https://paste.opendev.org/show/bKhTJvlywCKjbONAg8QH/
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2017784/+subscriptions
References