-
Notifications
You must be signed in to change notification settings - Fork 583
(MODULES-5003) file_line does not change multiple lines when one matches #794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tphoney
merged 2 commits into
puppetlabs:master
from
tkishel:MODULES-5003-file_line_does_not_change_multiple_lines_when_one_matches
Jul 14, 2017
Merged
(MODULES-5003) file_line does not change multiple lines when one matches #794
tphoney
merged 2 commits into
puppetlabs:master
from
tkishel:MODULES-5003-file_line_does_not_change_multiple_lines_when_one_matches
Jul 14, 2017
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The exists? method is called to determine the need to call the create and destroy methods. When the ensure, match, and multiple attributes are defined, the exists? method needs to return false unless all the lines that match the match attribute equal the line attribute. The first commit is minimal, and implements this change. The second commit normalizes the code, which I needed for comprehension.
The exists? method is called to determine the need to call the create and destroy methods. When the ensure, match, and multiple attributes are defined, the exists? method needs to return false unless all the lines that match the match attribute equal the line attribute. The first commit is minimal, and implements this change. The second commit normalizes the code, which I needed for comprehension.
Thanks @tkishel superb work |
hunner
added a commit
to hunner/puppetlabs-stdlib
that referenced
this pull request
Oct 13, 2017
https://tickets.puppetlabs.com/browse/MODULES-5003 gave rise to puppetlabs#788 and puppetlabs#794 which caused different behavior based on whether the line value was matched by the match regex or not. This resolves the behavior by adding a new parameter to control whether multiple matches should universally be replaced by the line value, or whether matches should be left alone when the line exists elsewhere in the file. This problem only affects modifying multiple lines when the line already exists. I also revised many of the tests and some of the documentation where wrong or ambiguous.
hunner
added a commit
to hunner/puppetlabs-stdlib
that referenced
this pull request
Oct 13, 2017
https://tickets.puppetlabs.com/browse/MODULES-5003 gave rise to puppetlabs#788 and puppetlabs#794 which caused different behavior based on whether the line value was matched by the match regex or not. This resolves the behavior by adding a new parameter to control whether multiple matches should universally be replaced by the line value, or whether matches should be left alone when the line exists elsewhere in the file. This problem only affects modifying multiple lines when the line already exists. I also revised many of the tests and some of the documentation where wrong or ambiguous.
hunner
added a commit
to hunner/puppetlabs-stdlib
that referenced
this pull request
Oct 16, 2017
https://tickets.puppetlabs.com/browse/MODULES-5003 gave rise to puppetlabs#788 and puppetlabs#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 when `multiple` is set to `true`". [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 the `line` value already exists. [bugfix] This commit more strictly defines the various interactions of `ensure`, `match`, `append_on_no_match`, `replace`, `multiple`, and `replace_all_matches_not_matching_line`. It also more clearly documents and tests these interactions.
cegeka-jenkins
pushed a commit
to cegeka/puppet-stdlib
that referenced
this pull request
Jul 17, 2019
https://tickets.puppetlabs.com/browse/MODULES-5003 gave rise to puppetlabs/puppetlabs-stdlib#788 and puppetlabs/puppetlabs-stdlib#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 when `multiple` is set to `true`". [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 the `line` value already exists. [bugfix] This commit more strictly defines the various interactions of `ensure`, `match`, `append_on_no_match`, `replace`, `multiple`, and `replace_all_matches_not_matching_line`. It also more clearly documents and tests these interactions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The exists? method is called to determine the need to call the create and
destroy methods. When the :ensure, :match, and :multiple attributes are defined,
the exists? method needs to return false unless all the lines that match the
:match attribute are equal to the :line attribute.
The first commit is minimal, and implements this change.
The second commit normalizes the code, which I needed for comprehension.
Either resolves the issue.