From b7ad86acd0a404f48cee57334a23cfe00a809784 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 6 Jan 2017 16:37:22 -0500 Subject: [PATCH] only warn if non whitespace junk --- lib/ansible/module_utils/json_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/json_utils.py b/lib/ansible/module_utils/json_utils.py index d46626124b..480b258882 100644 --- a/lib/ansible/module_utils/json_utils.py +++ b/lib/ansible/module_utils/json_utils.py @@ -68,7 +68,10 @@ def _filter_non_json_lines(data): # Trailing junk is uncommon and can point to things the user might # want to change. So print a warning if we find any trailing_junk = lines[len(lines) - reverse_end_offset:] - warnings.append('Module invocation had junk after the JSON data: %s' % '\n'.join(trailing_junk)) + for line in trailing_junk: + if line.strip(): + warnings.append('Module invocation had junk after the JSON data: %s' % '\n'.join(trailing_junk)) + break lines = lines[:(len(lines) - reverse_end_offset)]