Setup logging without fixing evenlet logging

Since [1], ``oslo_log.log.setup`` can be called without applying the
fix for eventlet in native threads [2]. This fix clashes with the
oslo.privsep logging handler that replaces the original one. This
handler is implemented to allow the sync between the daemon process
and the process making the privileged call.

Once the oslo.log library version is bumped to 5.0.2, the try clause
can be removed.

[1]https://review.opendev.org/c/openstack/oslo.log/+/864252
[2]https://review.opendev.org/c/openstack/oslo.log/+/852443

Closes-Bug: #1995514
Related-Bug: #1995091
Change-Id: I7a4c55228064cb2dd4f4a359cdd81fd288baaf68
This commit is contained in:
Rodolfo Alonso Hernandez 2022-11-11 10:30:24 +01:00
parent 1020c6fbf5
commit c2b6df05e0
1 changed files with 8 additions and 1 deletions

View File

@ -551,7 +551,14 @@ def helper_main():
logging.register_options(cfg.CONF)
cfg.CONF(args=sys.argv[1:], project='privsep')
logging.setup(cfg.CONF, 'privsep') # note replace_logging call below
# note replace_logging call below
try:
logging.setup(cfg.CONF, 'privsep', fix_eventlet=False)
except TypeError:
# NOTE(ralonsoh): in case of using oslo.log<5.0.2, kwarg
# "fix_eventlet" won't be defined. Remove this try clause when oslo.log
# is bumped.
logging.setup(cfg.CONF, 'privsep')
context = importutils.import_class(cfg.CONF.privsep_context)
from oslo_privsep import priv_context # Avoid circular import