mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-31 13:29:08 -07:00
Fix piped transfer with become (#34584)
* Ignore become if we shouldn't be sudoable * More explicit passing of kwargs * dd/piped put should be sudoable=False. Fixes #34523
This commit is contained in:
parent
fbe46c5e21
commit
03794864c2
1 changed files with 3 additions and 3 deletions
|
@ -663,7 +663,7 @@ class Connection(ConnectionBase):
|
||||||
# only when using ssh. Otherwise we can send initial data straightaway.
|
# only when using ssh. Otherwise we can send initial data straightaway.
|
||||||
|
|
||||||
state = states.index('ready_to_send')
|
state = states.index('ready_to_send')
|
||||||
if b'ssh' in cmd:
|
if b'ssh' in cmd and sudoable:
|
||||||
if self._play_context.prompt:
|
if self._play_context.prompt:
|
||||||
# We're requesting escalation with a password, so we have to
|
# We're requesting escalation with a password, so we have to
|
||||||
# wait for a password prompt.
|
# wait for a password prompt.
|
||||||
|
@ -872,7 +872,7 @@ class Connection(ConnectionBase):
|
||||||
def _run(self, cmd, in_data, sudoable=True, checkrc=True):
|
def _run(self, cmd, in_data, sudoable=True, checkrc=True):
|
||||||
"""Wrapper around _bare_run that retries the connection
|
"""Wrapper around _bare_run that retries the connection
|
||||||
"""
|
"""
|
||||||
return self._bare_run(cmd, in_data, sudoable, checkrc)
|
return self._bare_run(cmd, in_data, sudoable=sudoable, checkrc=checkrc)
|
||||||
|
|
||||||
@_ssh_retry
|
@_ssh_retry
|
||||||
def _file_transport_command(self, in_path, out_path, sftp_action):
|
def _file_transport_command(self, in_path, out_path, sftp_action):
|
||||||
|
@ -933,7 +933,7 @@ class Connection(ConnectionBase):
|
||||||
else:
|
else:
|
||||||
in_data = open(to_bytes(in_path, errors='surrogate_or_strict'), 'rb').read()
|
in_data = open(to_bytes(in_path, errors='surrogate_or_strict'), 'rb').read()
|
||||||
in_data = to_bytes(in_data, nonstring='passthru')
|
in_data = to_bytes(in_data, nonstring='passthru')
|
||||||
(returncode, stdout, stderr) = self.exec_command('dd of=%s bs=%s' % (out_path, BUFSIZE), in_data=in_data)
|
(returncode, stdout, stderr) = self.exec_command('dd of=%s bs=%s' % (out_path, BUFSIZE), in_data=in_data, sudoable=False)
|
||||||
|
|
||||||
# Check the return code and rollover to next method if failed
|
# Check the return code and rollover to next method if failed
|
||||||
if returncode == 0:
|
if returncode == 0:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue