Files
Nexus/docs/changelog/2026-06-07-script-exec-ssh-not-agent-online.md
T
2026-07-08 22:31:31 +08:00

966 B
Raw Blame History

脚本执行:移除 Agent 在线门禁,改判 SSH 凭据

日期: 2026-06-07

变更摘要

ScriptService._dispatch_to_servers 不再要求 is_online(Agent 心跳),改为检查服务器是否存在且已配置 SSH 凭据后直连 SSH 执行。

动机

用户执行脚本 #3 于 2 台服务器瞬间 failed (2 台失败)。根因:经「批量 IP / 凭据轮询」入库的机器通常 无 Agentis_online=false,旧逻辑直接跳过并记 exit_code=-1,与「脚本走 SSH」设计矛盾。

涉及文件

  • server/application/services/script_service.py_server_ssh_configured、dispatch / 拉日志
  • tests/test_script_dispatch.py — 回归单测

迁移 / 重启

  • 需重启 API worker

验证方式

pytest tests/test_script_dispatch.py -q

对无 Agent、有 SSH 凭据的服务器执行短脚本,应不再秒失败;执行详情 stderr 不再出现 Server offline or not found