From 460b0e1ab67da65c99bd35132e87a0a07178d486 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Mon, 26 Sep 2016 07:58:14 -0600 Subject: [PATCH] Match existing INI file entry with leading whitespace (fixes #4997) (#4998) --- lib/ansible/modules/files/ini_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/files/ini_file.py b/lib/ansible/modules/files/ini_file.py index 2d6307f77a..f440f01de2 100644 --- a/lib/ansible/modules/files/ini_file.py +++ b/lib/ansible/modules/files/ini_file.py @@ -108,7 +108,7 @@ import re def match_opt(option, line): option = re.escape(option) - return re.match('%s( |\t)*=' % option, line) \ + return re.match(' *%s( |\t)*=' % option, line) \ or re.match('# *%s( |\t)*=' % option, line) \ or re.match('; *%s( |\t)*=' % option, line) @@ -117,7 +117,7 @@ def match_opt(option, line): def match_active_opt(option, line): option = re.escape(option) - return re.match('%s( |\t)*=' % option, line) + return re.match(' *%s( |\t)*=' % option, line) # ============================================================== # do_ini