fix(deploy): tolerate absent Docker health state during router recovery

Containers without a configured HEALTHCHECK omit State.Health. Direct map
field access in the new inspect template made recovery prechecks fail on
longconn/edge before the router path could be repaired. Use a guarded map
index and report health=none without weakening image/config/key checks.

Distinguish service lookup errors from inspect/template failures instead of
misreporting every query failure as no unique container. Identify the
container-inspect stage in safe command errors.

Add regressions for absent health state through state and the full partial
router repair, plus accurate inspect failure classification. Validation:
265 passed, 3 skipped (no real PostgreSQL), 30 existing warnings; tool tests
52 passed. Python 3.7 syntax and staged diff checks pass.
No remote keys/configuration or containers were changed; rerun the existing
repair-router plan after updating, do not prepare or activate again.
This commit is contained in:
ex_tianzy
2026-11-04 16:33:35 +08:00
parent 8a94d60155
commit ce965aaf58
4 changed files with 66 additions and 3 deletions
+2
View File
@@ -124,6 +124,8 @@ sudo python3 deployable/scripts/broker_deploy.py repair-router \
新prepare已包含此参数;build/activate的隔离容器现在会实际加载挂载的router公钥,不能只验证Settings字段就标记候选就绪。`state`不打印原始日志或环境,只报告原/候选镜像类别、容器状态/健康/退出码和固定错误类。已部分切换时rollback可识别停止或重启中的已知候选容器,但拒绝未知镜像;原有回滚限制仍适用。
兼容修订:没有HEALTHCHECK的longconn/edge不包含State.Health,旧查询模板会因此在修复开始前失败。新模板使用可选map键读取并将其健康状态记为none;容器inspect失败与确实查不到唯一容器分别报告。更新后对原计划再次执行repair-router即可,不需重新prepare、删除备份或生成密钥。
### 完整回退
若切换失败,先停止broker客户端继续使用,按记录的每服务镜像回退: