Merge pull request #49592 from dwoz/bin_file_fix

Fix binary file manage test
This commit is contained in:
Daniel Wozniak 2018-09-10 16:03:17 -07:00 committed by GitHub
commit 4478a44559
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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: