mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Fix unicode handling in connection plugins.
This commit is contained in:
parent
e52c1f26d3
commit
f878a5d2e0
5 changed files with 16 additions and 15 deletions
|
@ -111,7 +111,7 @@ class Connection(ConnectionBase):
|
|||
local_cmd = [self.jexec_cmd, self.jail, executable, '-c', cmd]
|
||||
|
||||
display.vvv("EXEC %s" % (local_cmd,), host=self.jail)
|
||||
local_cmd = map(to_bytes, local_cmd)
|
||||
local_cmd = [to_bytes(i, errors='strict') for i in local_cmd]
|
||||
p = subprocess.Popen(local_cmd, shell=False, stdin=stdin,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
|
@ -154,7 +154,7 @@ class Connection(ConnectionBase):
|
|||
|
||||
out_path = pipes.quote(self._prefix_login_path(out_path))
|
||||
try:
|
||||
with open(in_path, 'rb') as in_file:
|
||||
with open(to_bytes(in_path, errors='strict'), 'rb') as in_file:
|
||||
try:
|
||||
p = self._buffered_exec_command('dd of=%s bs=%s' % (out_path, BUFSIZE), stdin=in_file)
|
||||
except OSError:
|
||||
|
@ -180,7 +180,7 @@ class Connection(ConnectionBase):
|
|||
except OSError:
|
||||
raise AnsibleError("jail connection requires dd command in the jail")
|
||||
|
||||
with open(out_path, 'wb+') as out_file:
|
||||
with open(to_bytes(out_path, errors='strict'), 'wb+') as out_file:
|
||||
try:
|
||||
chunk = p.stdout.read(BUFSIZE)
|
||||
while chunk:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue