Fix binary file manage test

This commit is contained in:
Daniel A Wozniak 2018-09-10 15:26:23 +00:00 committed by Daniel A. Wozniak
parent 9e3b44d6af
commit e51b0f8c7e
No known key found for this signature in database
GPG key ID: 166B9D2C06C82D61

View file

@ -5462,11 +5462,11 @@ def manage_file(name,
# Write the static contents to a temporary file
tmp = salt.utils.files.mkstemp(prefix=salt.utils.files.TEMPFILE_PREFIX,
text=True)
if salt.utils.platform.is_windows():
contents = os.linesep.join(
_splitlines_preserving_trailing_newline(contents))
with salt.utils.files.fopen(tmp, 'wb') as tmp_:
if encoding:
if salt.utils.platform.is_windows():
contents = os.linesep.join(
_splitlines_preserving_trailing_newline(contents))
log.debug('File will be encoded with %s', encoding)
tmp_.write(contents.encode(encoding=encoding, errors=encoding_errors))
else: