Skip to content

Commit

Permalink
Whoops missed this file entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
xeacott committed Aug 29, 2019
1 parent 685195d commit 95cbab7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions salt/states/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2712,9 +2712,18 @@ def managed(name,
contents = ''
for part in validated_contents:
for line in part.splitlines():
contents += line.rstrip('\n').rstrip('\r') + os.linesep
if contents_newline and not contents.endswith(os.linesep):
contents += os.linesep
if not (line == validated_contents[-1]):
# So long as we havent reached the end strip out the
# newline and carriage return and add a platform
# specific line ending with os.linesep
contents += line.rstrip('\n').rstrip('\r') + os.linesep
else:
# Were at the last line decide if a newline needs to
# go in or not
contents += line.rstrip('\n').rstrip('\r')
if contents_newline:
contents += os.linesep

except UnicodeDecodeError:
# Either something terrible happened, or we have binary data.
if template:
Expand Down

0 comments on commit 95cbab7

Please sign in to comment.