From 8f75a5677c998214ab750680a3d9b710bca34037 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Tue, 6 Jan 2026 15:34:08 +0800 Subject: [PATCH] fix: paramiko start ssh tunnel failed --- apps/libs/ansible/modules_utils/remote_client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/libs/ansible/modules_utils/remote_client.py b/apps/libs/ansible/modules_utils/remote_client.py index d2a7dc064..71a74aca2 100644 --- a/apps/libs/ansible/modules_utils/remote_client.py +++ b/apps/libs/ansible/modules_utils/remote_client.py @@ -73,6 +73,12 @@ def raise_timeout(name=''): return decorate +def _strip_wrapping_quotes(value): + if value and len(value) >= 2 and value[0] == value[-1] and value[0] in ("'", '"'): + return value[1:-1] + return value + + class OldSSHTransport(paramiko.transport.Transport): _preferred_pubkeys = ( "ssh-ed25519", @@ -271,8 +277,8 @@ class SSHClient: return password, port, username, remote_addr, key_path = match.groups() - password = password or None - key_path = key_path or None + password = _strip_wrapping_quotes(password) or None + key_path = _strip_wrapping_quotes(key_path) or None server = SSHTunnelForwarder( (remote_addr, int(port)),