Skip to content
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

Feature/issue 52329 lineinfile insertafter before regex match #52414

Open
wants to merge 5 commits into
base: devel
from

Conversation

Projects
None yet
3 participants
@winem
Copy link

winem commented Feb 17, 2019

SUMMARY

Fixes #52329

The break if the insertafter regex matched the current line prevented the module from finding the line that matches the regex if this line appeared after the line that matched the insertafter regex.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lineinfile

ADDITIONAL INFORMATION

I realized that the same unexpected result would appear if insertbefore is used with firstmatch: yes if regexp regex matches later than insertbefore. So I changed the behaviour for both cases.

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 17, 2019

Marcel Weinberg added some commits Feb 17, 2019

Marcel Weinberg
Marcel Weinberg
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 17, 2019

The test ansible-test sanity --test changelog [explain] failed with the error:

Command "/usr/bin/python test/sanity/code-smell/changelog.py" returned exit status 1.
>>> Standard Error
Traceback (most recent call last):
  File "packaging/release/changelogs/changelog.py", line 818, in <module>
    main()
  File "packaging/release/changelogs/changelog.py", line 100, in main
    args.func(args)
  File "packaging/release/changelogs/changelog.py", line 111, in command_lint
    lint_fragments(fragments, exceptions)
  File "packaging/release/changelogs/changelog.py", line 231, in lint_fragments
    errors += linter.lint(fragment)
  File "packaging/release/changelogs/changelog.py", line 311, in lint
    errors += [(fragment.path, 0, 0, result[1]) for result in results]
  File "packaging/release/changelogs/changelog.py", line 311, in <listcomp>
    errors += [(fragment.path, 0, 0, result[1]) for result in results]
  File "/usr/local/lib/python3.6/dist-packages/rstcheck.py", line 169, in check
    find_ignored_languages(source)
  File "/usr/local/lib/python3.6/dist-packages/rstcheck.py", line 235, in find_ignored_languages
    for (index, line) in enumerate(source.splitlines()):
AttributeError: 'dict' object has no attribute 'splitlines'
Traceback (most recent call last):
  File "test/sanity/code-smell/changelog.py", line 14, in <module>
    main()
  File "test/sanity/code-smell/changelog.py", line 10, in main
    subprocess.check_call(cmd)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['packaging/release/changelogs/changelog.py', 'lint', 'changelogs/fragments/52329-lineinfile-adds-new-line-on-each-iteration-insertafter-before-regexp.yaml']' returned non-zero exit status 1.

click here for bot help

@ansibot ansibot added needs_revision and removed core_review labels Feb 17, 2019

@ansibot ansibot added core_review and removed needs_revision labels Feb 18, 2019

@samdoran samdoran self-assigned this Feb 19, 2019

@samdoran samdoran removed the needs_triage label Feb 19, 2019

@ansibot ansibot added the stale_ci label Feb 27, 2019

@ansibot ansibot added the files label Mar 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.