diff --git a/changelogs/fragments/60595-systemd_import.yml b/changelogs/fragments/60595-systemd_import.yml new file mode 100644 index 00000000000..226b244886c --- /dev/null +++ b/changelogs/fragments/60595-systemd_import.yml @@ -0,0 +1,2 @@ +minor_changes: +- Add an additional check for importing journal from systemd-python module (https://github.com/ansible/ansible/issues/60595). diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index a4d211f4d40..9c0cc308a28 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -65,7 +65,9 @@ except ImportError: try: from systemd import journal - has_journal = True + # 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: has_journal = False