Set the correct return message.

In these cases, the lines are added, not replaced.

(cherry picked from commit 3216c31401)
pull/50083/head
Jérémy Lecour 7 years ago committed by Jérémy Lecour
parent 1a13bf06a3
commit 5bd04bd5d5

@ -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:

Loading…
Cancel
Save