mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Add warning when using an empty regexp in lineinfile (#42013)
* Revert "Account for empty string regexp in lineinfile (#41451)"
This reverts commit 4b5b4a760c
.
* Use context managers for interacting with files
* Store line and regexp parameters in a variable
* Add warning when regexp is an empty string
* Remove '=' from error messages
* Update warning message and add changelog
* Add tests
* Improve warning message
Offer an equivalent regexp that won't trigger the warning.
Update tests to match new warning.
* Add porting guide entry for lineinfile change
This commit is contained in:
parent
b6f2aad600
commit
fb55038d75
4 changed files with 34 additions and 15 deletions
|
@ -70,6 +70,11 @@ Major changes in popular modules are detailed here
|
|||
:ref:`DEFAULT_SYSLOG_FACILITY`. If you have :ref:`DEFAULT_SYSLOG_FACILITY` configured, the
|
||||
location of remote logs on systems which use journald may change.
|
||||
|
||||
* The ``lineinfile`` module was changed to show a warning when using an empty string as a regexp.
|
||||
Since an empty regexp matches every line in a file, it will replace the last line in a file rather
|
||||
than inserting. If this is the desired behavior, use ``'^'`` which will match every line and
|
||||
will not trigger the warning.
|
||||
|
||||
|
||||
Modules removed
|
||||
---------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue