From 24ac642c5eeab5bbf69956dd2bf069d5b9d41e12 Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Tue, 4 Nov 2025 16:34:03 +0800 Subject: [PATCH] fix: Escape percentage signs in gateway password for sshpass command --- apps/ops/ansible/inventory.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/ops/ansible/inventory.py b/apps/ops/ansible/inventory.py index 9e8c1e97b..91ddfccfa 100644 --- a/apps/ops/ansible/inventory.py +++ b/apps/ops/ansible/inventory.py @@ -76,7 +76,8 @@ class JMSInventory: proxy_command_list.extend(["-W", "%h:%p", "-q"]) if gateway.password: - proxy_command_list.insert(0, f"sshpass -p {gateway.password}") + password = gateway.password.replace("%", "%%") + proxy_command_list.insert(0, f"sshpass -p '{password}'") if gateway.private_key: proxy_command_list.append(f"-i {gateway.get_private_key_path(path_dir)}")