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

29 lines
966 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 脚本执行:移除 Agent 在线门禁,改判 SSH 凭据
**日期**: 2026-06-07
## 变更摘要
`ScriptService._dispatch_to_servers` 不再要求 `is_online`(Agent 心跳),改为检查服务器是否存在且已配置 SSH 凭据后直连 SSH 执行。
## 动机
用户执行脚本 #3 于 2 台服务器瞬间 `failed (2 台失败)`。根因:经「批量 IP / 凭据轮询」入库的机器通常 **无 Agent**`is_online=false`,旧逻辑直接跳过并记 `exit_code=-1`,与「脚本走 SSH」设计矛盾。
## 涉及文件
- `server/application/services/script_service.py``_server_ssh_configured`、dispatch / 拉日志
- `tests/test_script_dispatch.py` — 回归单测
## 迁移 / 重启
- 需重启 API worker
## 验证方式
```bash
pytest tests/test_script_dispatch.py -q
```
对无 Agent、有 SSH 凭据的服务器执行短脚本,应不再秒失败;执行详情 stderr 不再出现 `Server offline or not found`