File reset-eventlet-hub-after-patching.patch of Package python-oslo.service
commit 338fd2c3f114f35f5cee07027d3322e70ba8ecf6
Author: Jacek Tomasiak <jacek.tomasiak@gmail.com>
Date: Wed Sep 30 11:26:11 2020 +0200
Upstream review: https://review.opendev.org/c/openstack/oslo.service/+/755245 -
(rejected because upstream no longer requires any event hub
handling code due to using a more recent eventlet version)
Reset eventlet hub after patching
Patching the eventlet hub by setting the environment variable will not be
effective if hub singleton was already set by some imported module.
Calling `use_hub()` will reset it's value based on the current overrides.
Change-Id: Ida6756b50266b4b2b2545f82e03e83e1c3be1e9e
Closes-Bug: #1897877
diff --git a/oslo_service/__init__.py b/oslo_service/__init__.py
index 0c3807e0e301..1ac132bad90d 100644
--- a/oslo_service/__init__.py
+++ b/oslo_service/__init__.py
@@ -31,3 +31,5 @@ def service_hub():
os.environ['EVENTLET_HUB'] = 'oslo_service:service_hub'
+# reset hub in case it was initialized already by some imported module
+eventlet.hubs.use_hub(os.environ['EVENTLET_HUB'])