summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gaffney <andrew@agaffney.org>2016-09-26 07:58:14 -0600
committerToshio Kuratomi <a.badger@gmail.com>2016-09-26 07:03:27 -0700
commiteef7b779a84626e4a14e685ab8e648ebe7def4cf (patch)
tree21f4940ae9550af9c8fffe87a3dc2398181deb7e
parent415c3399488ff07ae0e06e4b1d8c8a1b0bf44d22 (diff)
downloadansible-modules-core-eef7b779a84626e4a14e685ab8e648ebe7def4cf.tar.gz
Match existing INI file entry with leading whitespace (fixes #4997) (#4998)
-rw-r--r--files/ini_file.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/files/ini_file.py b/files/ini_file.py
index fc45f761..b7cdd7b7 100644
--- a/files/ini_file.py
+++ b/files/ini_file.py
@@ -104,22 +104,23 @@ EXAMPLES = '''
import ConfigParser
import sys
import os
+import re
# ==============================================================
# match_opt
def match_opt(option, line):
option = re.escape(option)
- return re.match('%s *=' % option, line) \
- or re.match('# *%s *=' % option, line) \
- or re.match('; *%s *=' % option, line)
+ return re.match(' *%s( |\t)*=' % option, line) \
+ or re.match('# *%s( |\t)*=' % option, line) \
+ or re.match('; *%s( |\t)*=' % option, line)
# ==============================================================
# match_active_opt
def match_active_opt(option, line):
option = re.escape(option)
- return re.match('%s *=' % option, line)
+ return re.match(' *%s( |\t)*=' % option, line)
# ==============================================================
# do_ini