From c8ffe94bf4ccac493f98af2cc4f984d1c143a772 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 18 Jan 2016 13:48:37 -0800 Subject: [PATCH] Fix proposed by @Yannig to fix become success detection when the output is multiline See the Bug report for a specific error case with local connection, sudo, and the raw module Fixes #13728 --- lib/ansible/plugins/connection/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/connection/__init__.py b/lib/ansible/plugins/connection/__init__.py index ff00bc02380..bea8e5b426b 100644 --- a/lib/ansible/plugins/connection/__init__.py +++ b/lib/ansible/plugins/connection/__init__.py @@ -206,7 +206,10 @@ class ConnectionBase(with_metaclass(ABCMeta, object)): pass def check_become_success(self, output): - return self._play_context.success_key == output.rstrip() + for line in output.splitlines(True): + if self._play_context.success_key == line.rstrip(): + return True + return False def check_password_prompt(self, output): if self._play_context.prompt is None: