Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where some versions of systemd don't have journal.sendv #60692

Open
wants to merge 3 commits into
base: devel
from

Conversation

@Rylan12
Copy link

commented Aug 16, 2019

SUMMARY

Fixes #60595
Ansible failed when trying to run journal.sendv if the wrong version of systemd was installed. This change makes sure that journal.sendv exists before setting has_journal = True

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ansible/module_utils/basic.py

ADDITIONAL INFORMATION

Before:

The full traceback is:
Traceback (most recent call last):
  File "<stdin>", line 114, in <module>
  File "<stdin>", line 106, in _ansiballz_main
  File "<stdin>", line 49, in invoke_module
  File "/usr/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 170, in load_source
    module = _exec(spec, sys.modules[name])
  File "<frozen importlib._bootstrap>", line 626, in _exec
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/tmp/ansible_command_payload_afjk26dr/__main__.py", line 327, in <module>
  File "/tmp/ansible_command_payload_afjk26dr/__main__.py", line 228, in main
  File "/tmp/ansible_command_payload_afjk26dr/ansible_command_payload.zip/ansible/module_utils/basic.py", line 691, in __init__
  File "/tmp/ansible_command_payload_afjk26dr/ansible_command_payload.zip/ansible/module_utils/basic.py", line 1940, in _log_invocation
  File "/tmp/ansible_command_payload_afjk26dr/ansible_command_payload.zip/ansible/module_utils/basic.py", line 1898, in log
  File "systemd/_journal.pyx", line 68, in systemd._journal.send
  File "systemd/_journal.pyx", line 32, in systemd._journal._send
ValueError: Key name may not begin with an underscore

fatal: [pi]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 114, in <module>\n  File \"<stdin>\", line 106, in _ansiballz_main\n  File \"<stdin>\", line 49, in invoke_module\n  File \"/usr/lib/python3.5/imp.py\", line 234, in load_module\n    return load_source(name, filename, file)\n  File \"/usr/lib/python3.5/imp.py\", line 170, in load_source\n    module = _exec(spec, sys.modules[name])\n  File \"<frozen importlib._bootstrap>\", line 626, in _exec\n  File \"<frozen importlib._bootstrap_external>\", line 673, in exec_module\n  File \"<frozen importlib._bootstrap>\", line 222, in _call_with_frames_removed\n  File \"/tmp/ansible_command_payload_afjk26dr/__main__.py\", line 327, in <module>\n  File \"/tmp/ansible_command_payload_afjk26dr/__main__.py\", line 228, in main\n  File \"/tmp/ansible_command_payload_afjk26dr/ansible_command_payload.zip/ansible/module_utils/basic.py\", line 691, in __init__\n  File \"/tmp/ansible_command_payload_afjk26dr/ansible_command_payload.zip/ansible/module_utils/basic.py\", line 1940, in _log_invocation\n  File \"/tmp/ansible_command_payload_afjk26dr/ansible_command_payload.zip/ansible/module_utils/basic.py\", line 1898, in log\n  File \"systemd/_journal.pyx\", line 68, in systemd._journal.send\n  File \"systemd/_journal.pyx\", line 32, in systemd._journal._send\nValueError: Key name may not begin with an underscore\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

After:

changed: [pi]
Rylan12 added 2 commits Aug 16, 2019

@ansibot ansibot removed the small_patch label Aug 17, 2019

@sivel sivel added P3 and removed needs_triage labels Aug 20, 2019

@ansibot ansibot added core_review and removed needs_revision labels Aug 20, 2019

@ansibot ansibot added the stale_ci label Sep 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.