yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #88682
[Bug 1968606] Re: Importing neutron.common.config module registers config options
Reviewed: https://review.opendev.org/c/openstack/neutron/+/837392
Committed: https://opendev.org/openstack/neutron/commit/4d3a274765a364f6f7b6bff163d6f7110bdbdbbe
Submitter: "Zuul (22348)"
Branch: master
commit 4d3a274765a364f6f7b6bff163d6f7110bdbdbbe
Author: Jakub Libosvar <libosvar@xxxxxxxxxx>
Date: Mon Apr 11 21:45:49 2022 +0000
Don't register config options on imports
Importing some modules lead to registering config options that may
collide with config options from a project that calls the import. This
patch wraps the side effect that registers config options into a
function that needs to be called in case the caller wants to register
the options.
This solution is also not perfect as it guards the common options to be
registered only once even if the function is called multiple times. This
is to solve problems in unittests, ideally we should always call the
function just once even in our testing suites.
Resolves-Bug: #1968606
Change-Id: Ic1532eb8de887ff1b1085206df11f53e22f7f524
Signed-off-by: Jakub Libosvar <libosvar@xxxxxxxxxx>
** 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/1968606
Title:
Importing neutron.common.config module registers config options
Status in neutron:
Fix Released
Bug description:
In case neutron.common.config is imported some config options are
registered as a side effect without calling any function. This is
causing errors for projects that import also other modules that end up
importing neutron.common.config - such as neutorn.db.models_v2. If a
project needs Neutron basic DB models and uses same config options
then there is no way how to make it work. Performing any action on
imports is an anti-pattern in Python.
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1968606/+subscriptions
References