Merge pull request #49090 from dwoz/file_line_fix

Search for (but do not include) CRLF line ending
This commit is contained in:
Daniel Wozniak 2018-08-13 15:00:33 -07:00 committed by GitHub
commit 8954dd269f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.