c8b0663508
批量添加替代CSV并支持去重;脚本库页内嵌执行历史;推送历史记录 rsync 权限策略; 脚本执行不再依赖 Agent 在线;服务器同步日志与相关单测补齐。 Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
966 B
Markdown
29 lines
966 B
Markdown
# 脚本执行:移除 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`。
|