mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
utils/ssh: Split out the sudo_cmd
template
Split out the `sudo_cmd` template to reduce duplication for SSH based connections and for use from WA to ensure the template stays in sync.
This commit is contained in:
parent
a82db5ed37
commit
5473031ab7
@ -59,6 +59,9 @@ from devlib.connection import (ConnectionBase, ParamikoBackgroundCommand, PopenB
|
|||||||
SSHTransferManager)
|
SSHTransferManager)
|
||||||
|
|
||||||
|
|
||||||
|
DEFAULT_SSH_SUDO_COMMAND = "sudo -p ' ' -S -- sh -c {}"
|
||||||
|
|
||||||
|
|
||||||
ssh = None
|
ssh = None
|
||||||
scp = None
|
scp = None
|
||||||
sshpass = None
|
sshpass = None
|
||||||
@ -67,6 +70,7 @@ sshpass = None
|
|||||||
logger = logging.getLogger('ssh')
|
logger = logging.getLogger('ssh')
|
||||||
gem5_logger = logging.getLogger('gem5-connection')
|
gem5_logger = logging.getLogger('gem5-connection')
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _handle_paramiko_exceptions(command=None):
|
def _handle_paramiko_exceptions(command=None):
|
||||||
try:
|
try:
|
||||||
@ -286,7 +290,7 @@ class SshConnectionBase(ConnectionBase):
|
|||||||
keyfile=None,
|
keyfile=None,
|
||||||
port=None,
|
port=None,
|
||||||
platform=None,
|
platform=None,
|
||||||
sudo_cmd="sudo -p ' ' -S -- sh -c {}",
|
sudo_cmd=DEFAULT_SSH_SUDO_COMMAND,
|
||||||
strict_host_check=True,
|
strict_host_check=True,
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -369,7 +373,7 @@ class SshConnection(SshConnectionBase):
|
|||||||
port=22,
|
port=22,
|
||||||
timeout=None,
|
timeout=None,
|
||||||
platform=None,
|
platform=None,
|
||||||
sudo_cmd="sudo -p ' ' -S -- sh -c {}",
|
sudo_cmd=DEFAULT_SSH_SUDO_COMMAND,
|
||||||
strict_host_check=True,
|
strict_host_check=True,
|
||||||
use_scp=False,
|
use_scp=False,
|
||||||
poll_transfers=False,
|
poll_transfers=False,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user