From 0ebd19e97b40dc3ee9d71a30f1dca9efa1e60529 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Wed, 16 Jul 2014 18:14:35 +0200 Subject: [PATCH] Fix regression: Sanitize sudo success_key from stdout Commit 7e3dd10 caused a regression with sanitizing the sudo success_key from stdout. There is no newline in front of SUDO-SUCCESS when using sudo. This change adapts the regex to make the line break optional. Tested on Ubuntu 14.04. --- lib/ansible/runner/action_plugins/raw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/raw.py b/lib/ansible/runner/action_plugins/raw.py index 774e62f7ef..548eafbf70 100644 --- a/lib/ansible/runner/action_plugins/raw.py +++ b/lib/ansible/runner/action_plugins/raw.py @@ -49,6 +49,6 @@ class ActionModule(object): # may leak into the stdout due to the way the sudo/su # command is constructed, so we filter that out here if result.get('stdout','').strip().startswith('SUDO-SUCCESS-'): - result['stdout'] = re.sub(r'^(\r)?\nSUDO-SUCCESS.*(\r)?\n', '', result['stdout']) + result['stdout'] = re.sub(r'^((\r)?\n)?SUDO-SUCCESS.*(\r)?\n', '', result['stdout']) return ReturnData(conn=conn, result=result)