From 6063071a4677971dc44d5a62b87ba47df48ed0e5 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Wed, 31 Aug 2016 16:49:45 +0200 Subject: [PATCH] Fix traceback on python3 (#4556) Traceback (most recent call last): File "/tmp/ansible_csqv781s/ansible_module_systemd.py", line 374, in main() File "/tmp/ansible_csqv781s/ansible_module_systemd.py", line 263, in main for line in out.split('\\n'): # systemd can have multiline values delimited with {} --- system/systemd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/systemd.py b/system/systemd.py index 3c83e3f69b7..fb94ba445e5 100644 --- a/system/systemd.py +++ b/system/systemd.py @@ -217,6 +217,7 @@ status: import os import glob from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_bytes, to_native # =========================================== # Main control flow @@ -260,7 +261,7 @@ def main(): # load return of systemctl show into dictionary for easy access and return k = None multival = [] - for line in out.split('\n'): # systemd can have multiline values delimited with {} + for line in to_native(out).split('\n'): # systemd can have multiline values delimited with {} if line.strip(): if k is None: if '=' in line: