mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Added comments
This commit is contained in:
parent
f3517a1852
commit
b9ddd53b04
1 changed files with 3 additions and 0 deletions
|
@ -1922,6 +1922,8 @@ def line(path, content=None, match=None, mode=None, location=None,
|
|||
with salt.utils.files.fopen(path, mode='r') as fp_:
|
||||
body = salt.utils.data.decode_list(fp_.readlines())
|
||||
body_before = hashlib.sha256(salt.utils.stringutils.to_bytes(''.join(body))).hexdigest()
|
||||
# Add empty line at the end if last line ends with eol.
|
||||
# Allows simpler code
|
||||
if body and _get_eol(body[-1]):
|
||||
body.append('')
|
||||
|
||||
|
@ -2017,6 +2019,7 @@ def line(path, content=None, match=None, mode=None, location=None,
|
|||
if not _get_eol(line) and idx+1 < len(body):
|
||||
prev = idx and idx-1 or 1
|
||||
body[idx] = _set_line_eol(body[prev], line)
|
||||
# We do not need empty line at the end anymore
|
||||
if '' == body[-1]:
|
||||
body.pop()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue