From 3276c2f0c4d7920aaffe51a3497579698b321beb Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 8 Sep 2012 14:53:34 -0400 Subject: [PATCH] lineinfile should use 'search' everywhere --- lineinfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lineinfile b/lineinfile index c183bb918d5..8405dc6637d 100755 --- a/lineinfile +++ b/lineinfile @@ -37,9 +37,9 @@ def present(module, name, regexp, line, insertafter, backup): index = [-1, -1] for lineno in range(0, len(lines)): - if mre.match(lines[lineno]): + if mre.search(lines[lineno]): index[0] = lineno - elif iare is not None and iare.match(lines[lineno]): + elif iare is not None and iare.search(lines[lineno]): # + 1 for the next line index[1] = lineno + 1 @@ -84,7 +84,7 @@ def absent(module, name, regexp, backup): cre = re.compile(regexp) found = [] def matcher(line): - if cre.match(line): + if cre.search(line): found.append(line) return False else: