mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Comprehensions converting to unicode replaced by salt.utils.data.decode_list
This commit is contained in:
parent
d3e8679e05
commit
5169b1f7fd
1 changed files with 3 additions and 3 deletions
|
@ -61,6 +61,7 @@ import salt.utils.stringutils
|
|||
import salt.utils.templates
|
||||
import salt.utils.url
|
||||
import salt.utils.user
|
||||
import salt.utils.data
|
||||
from salt.exceptions import CommandExecutionError, MinionError, SaltInvocationError, get_error_message as _get_error_message
|
||||
from salt.utils.files import HASHES, HASHES_REVMAP
|
||||
|
||||
|
@ -1919,7 +1920,7 @@ def line(path, content=None, match=None, mode=None, location=None,
|
|||
match = content
|
||||
|
||||
with salt.utils.files.fopen(path, mode='r') as fp_:
|
||||
body = [salt.utils.stringutils.to_unicode(line) for line in fp_.readlines()]
|
||||
body = salt.utils.data.decode_list(fp_.readlines())
|
||||
body_before = hashlib.sha256(salt.utils.stringutils.to_bytes(''.join(body))).hexdigest()
|
||||
if body and _get_eol(body[-1]):
|
||||
body.append('')
|
||||
|
@ -2033,8 +2034,7 @@ def line(path, content=None, match=None, mode=None, location=None,
|
|||
if changed:
|
||||
if show_changes:
|
||||
with salt.utils.files.fopen(path, 'r') as fp_:
|
||||
path_content = [salt.utils.stringutils.to_unicode(x)
|
||||
for x in fp_.read().splitlines(True)]
|
||||
path_content = salt.utils.data.decode_list(fp_.read().splitlines(True))
|
||||
changes_diff = ''.join(difflib.unified_diff(
|
||||
path_content, body
|
||||
))
|
||||
|
|
Loading…
Add table
Reference in a new issue