(MODULES-5651) Do not append infinitely #825
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://tickets.puppetlabs.com/browse/MODULES-5003 gave rise to #788 and #794 which caused different behavior based on whether the line value was matched by the match regex or not.
The change in behavior was both breaking and broken, though that was hard to tell because the behavior was ill-described in general.
[bugfix] This commit resolves the breaking behavior by reverting the behavior of "replacing matches when a line matching
line
exists even whenmultiple
is set totrue
".[feature] This commit adds a new parameter to make file_line replace all matches universally with the
line
value, even when the line exists elsewhere in the file. This feature only affects modifying multiple lines in a file when theline
value already exists.[bugfix] This commit more strictly defines the various interactions of
ensure
,match
,append_on_no_match
,replace
,multiple
, andreplace_all_matches_not_matching_line
. It also more clearly documents and tests these interactions.