Set the correct return message.

In these cases, the lines are added, not replaced.
This commit is contained in:
Jérémy Lecour 2018-12-01 22:09:45 +01:00
parent 150f5cb232
commit 3216c31401

View file

@ -338,12 +338,12 @@ def present(module, dest, regexp, line, insertafter, insertbefore, create,
if index[1] <= 0:
if b_lines[index[1]].rstrip(b('\r\n')) != b_line:
b_lines.insert(index[1], b_line + b_linesep)
msg = 'line replaced'
msg = 'line added'
changed = True
elif b_lines[index[1] - 1].rstrip(b('\r\n')) != b_line:
b_lines.insert(index[1], b_line + b_linesep)
msg = 'line replaced'
msg = 'line added'
changed = True
elif b_lines[index[0]] != b_new_line: