-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Skip if insertbefore is using BOF until later in the module #41767
Merged
samdoran
merged 1 commit into
ansible:devel
from
samdoran:issue/38219-lineinfile-insertbefore-bof
Jun 25, 2018
Merged
Skip if insertbefore is using BOF until later in the module #41767
samdoran
merged 1 commit into
ansible:devel
from
samdoran:issue/38219-lineinfile-insertbefore-bof
Jun 25, 2018
Conversation
This file contains 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
If a line match is found in the file and no regexp is specified, insertbefore would improperly try to add a line if set to BOF. Add tests for this scenario.
ansibot
added
affects_2.7
This issue/PR affects Ansible v2.7
bug
This issue/PR relates to a bug.
core_review
In order to be merged, this PR must follow the core review workflow.
module
This issue/PR relates to a module.
needs_triage
Needs a first human triage before being processed.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
test
This PR relates to tests.
labels
Jun 21, 2018
achinthagunasekara
approved these changes
Jun 21, 2018
jborean93
removed
the
needs_triage
Needs a first human triage before being processed.
label
Jun 21, 2018
samdoran
added a commit
to samdoran/ansible
that referenced
this pull request
Jun 25, 2018
If a line match is found in the file and no regexp is specified, insertbefore would improperly try to add a line if set to BOF. Add tests for this scenario. (cherry picked from commit eaae131)
samdoran
added a commit
to samdoran/ansible
that referenced
this pull request
Jun 25, 2018
If a line match is found in the file and no regexp is specified, insertbefore would improperly try to add a line if set to BOF. Add tests for this scenario. (cherry picked from commit eaae131)
jacum
pushed a commit
to jacum/ansible
that referenced
this pull request
Jun 26, 2018
If a line match is found in the file and no regexp is specified, insertbefore would improperly try to add a line if set to BOF. Add tests for this scenario.
kbreit
pushed a commit
to kbreit/ansible
that referenced
this pull request
Jul 3, 2018
…til later in the module (ansible#41929) * Skip if insertbefore BOF until later (ansible#41767) If a line match is found in the file and no regexp is specified, insertbefore would improperly try to add a line if set to BOF. Add tests for this scenario. (cherry picked from commit eaae131) * Add changelog fragment
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
affects_2.7
This issue/PR affects Ansible v2.7
bug
This issue/PR relates to a bug.
core_review
In order to be merged, this PR must follow the core review workflow.
module
This issue/PR relates to a module.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
test
This PR relates to tests.
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.
SUMMARY
When a regexp was not provided and insertbefore/insertafter were used, a line match anywhere in the file caused subsequent insertions to be skipeed. PR #33393 addressed this but introduced a bug that would cause the insertbefore section to evaluate to True with an in appropriate index value, causing an index out of bounds error or inserting the line in a very inappropriate place in the file.
Skipping this section of the code when using BOF with insertbefore and postponing that until later resolves the issue.
Fixes #38219 (and hopefully some others)
ISSUE TYPE
COMPONENT NAME
lineinfile.py
ANSIBLE VERSION