Lineinfile must not insert lines multiples times with insertbefore/insertafter (#49409)

* Change test suite to fit expected behaviour

This reverts some changes from ansible/ansible@723daf3
If a line is found in the file, exactly or via regexp matching, it must 
not be added again.
insertafter/insertbefore options are used only when a line is to be 
inserted, to specify where it must be added.

* Implement the change in behaviour mentioned in the previous commit

* Fix comment to reflect what the code does

* Set the correct return message.

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

* Add a changelog
This commit is contained in:
Jérémy Lecour
2018-12-17 22:42:24 +01:00
committed by Sam Doran
parent 7eb1ab45a7
commit 2fb9b46752
3 changed files with 54 additions and 23 deletions

View File

@@ -0,0 +1,3 @@
---
bugfixes:
- "This reverts some changes from commit 723daf3. If a line is found in the file, exactly or via regexp matching, it must not be added again. `insertafter`/`insertbefore` options are used only when a line is to be inserted, to specify where it must be added."