Module Logging with WSL2 (#76375)

* adding systemd daemon import

* adding coments and AttributeError exception

* adding minor fix to repeated syntax

* adding changelog
pull/76822/head
Abhinav Tripathy 3 years ago committed by GitHub
parent 8febd37f32
commit 8c06aada10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- Fix module logging issue when using custom module on WSL2 (https://github.com/ansible/ansible/issues/76320)

@ -64,11 +64,13 @@ except ImportError:
HAS_SYSLOG = False
try:
from systemd import journal
from systemd import journal, daemon as systemd_daemon
# Makes sure that systemd.journal has method sendv()
# Double check that journal has method sendv (some packages don't)
has_journal = hasattr(journal, 'sendv')
except ImportError:
# check if the system is running under systemd
has_journal = hasattr(journal, 'sendv') and systemd_daemon.booted()
except (ImportError, AttributeError):
# AttributeError would be caused from use of .booted() if wrong systemd
has_journal = False
HAVE_SELINUX = False

Loading…
Cancel
Save