Set the correct return message.

In these cases, the lines are added, not replaced.
pull/49409/head
Jérémy Lecour 6 years ago
parent 150f5cb232
commit 3216c31401

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

Loading…
Cancel
Save