Commit 565f3361 by Michael DeHaan

lineinfile should use 'search' everywhere

parent 14a9c3ab
...@@ -37,9 +37,9 @@ def present(module, name, regexp, line, insertafter, backup): ...@@ -37,9 +37,9 @@ def present(module, name, regexp, line, insertafter, backup):
index = [-1, -1] index = [-1, -1]
for lineno in range(0, len(lines)): for lineno in range(0, len(lines)):
if mre.match(lines[lineno]): if mre.search(lines[lineno]):
index[0] = 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 # + 1 for the next line
index[1] = lineno + 1 index[1] = lineno + 1
...@@ -84,7 +84,7 @@ def absent(module, name, regexp, backup): ...@@ -84,7 +84,7 @@ def absent(module, name, regexp, backup):
cre = re.compile(regexp) cre = re.compile(regexp)
found = [] found = []
def matcher(line): def matcher(line):
if cre.match(line): if cre.search(line):
found.append(line) found.append(line)
return False return False
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment