mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Search for (but do not include) CRLF line ending
When searching for a line in a file that has CRLF line endings, the normal $ regex will not match a line. With this change, we will match on but not include LF, CRLF, and the end of a file.
This commit is contained in:
parent
af6ec1dce2
commit
0dca634e3c
1 changed files with 1 additions and 1 deletions
|
@ -2111,7 +2111,7 @@ def replace(path,
|
|||
if prepend_if_not_found or append_if_not_found:
|
||||
# Search for content, to avoid pre/appending the
|
||||
# content if it was pre/appended in a previous run.
|
||||
if re.search(salt.utils.to_bytes('^{0}$'.format(re.escape(content))),
|
||||
if re.search(salt.utils.to_bytes('^{0}($|(?=\r\n))'.format(re.escape(content))),
|
||||
r_data,
|
||||
flags=flags_num):
|
||||
# Content was found, so set found.
|
||||
|
|
Loading…
Add table
Reference in a new issue