Import "oslo_config.cfg" before "eventlet"
Eventlet will patch the "os" library and how it works. If "oslo_config.cfg" is called after "eventlet": - "oslo_config.cfg" imports "stevedore" - "stevedore" imports "importlib_metadata" - this library will try to use "os.open" library, but patched - "eventlet" imports "oslo_service" - "oslo_service" imports "oslo_logging" - "oslo_logging" imports "oslo_config.cfg", but at this point, the instance cfg.CONF does not exist yet If "oslo_config.cfg" is imported before calling eventlet, "oslo_logging" is not called and there is no circular import. Closes-Bug: #1888213 [1]I8b08f289d446f4775eac1e1a91997fa96f25f641 Change-Id: Idcc04f46b2a01e24dfd56cef8121694439e0339e
This commit is contained in:
parent
a7010e9c4e
commit
bc99e56515
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from oslo_config import cfg # noqa
|
||||||
|
|
||||||
from neutron.common import eventlet_utils
|
from neutron.common import eventlet_utils
|
||||||
from neutron.tests.common.agents import l3_agent
|
from neutron.tests.common.agents import l3_agent
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import eventlet
|
from oslo_config import cfg # noqa
|
||||||
|
|
||||||
|
|
||||||
def print_binary_name():
|
def print_binary_name():
|
||||||
|
@ -31,6 +31,9 @@ def print_binary_name():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
import eventlet
|
||||||
|
|
||||||
if 'spawn' in sys.argv:
|
if 'spawn' in sys.argv:
|
||||||
eventlet.spawn(print_binary_name).wait()
|
eventlet.spawn(print_binary_name).wait()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue