修复自动备份真实挂载解析(07-27-automatic-offhost-backup)
ci-e2e / e2e (push) Waiting to run
ci-minimal / check-minimal (push) Waiting to run

这个提交包含在:
2026-07-27 11:19:13 +08:00
父节点 b78f2a11ce
当前提交 9875bc37a4
共修改 5 个文件,包含 34 行新增和 5 行删除
+3 -3
查看文件
@@ -239,11 +239,11 @@ if [[ "${1:-}" == "inspect" ]]; then
printf 'POSTGRES_DB=hyb_oa\nPOSTGRES_USER=backup_user\nPOSTGRES_PASSWORD=fixture\n'
fi
;;
*Mounts*)
*json*.Mounts*)
if [[ "$container" == "server-id" ]]; then
printf '/app/storage\t%s\n' "$MOCK_STORAGE"
printf '[{"Destination":"/app/storage","Source":"%s"}]\n' "$MOCK_STORAGE"
else
printf '/var/lib/postgresql/data\t%s\n' "$MOCK_PG"
printf '[{"Destination":"/var/lib/postgresql/data","Source":"%s"}]\n' "$MOCK_PG"
fi
;;
*Image*) printf 'sha256:%064d\n' 0 ;;
+12 -2
查看文件
@@ -134,8 +134,18 @@ container_env() {
mount_source() {
local container_id="$1"
local destination="$2"
docker inspect -f '{{range .Mounts}}{{println .Destination "\t" .Source}}{{end}}' "$container_id" \
| awk -F '\t' -v expected="$destination" '$1 == expected { print $2 }'
docker inspect -f '{{json .Mounts}}' "$container_id" \
| python3 -c '
import json
import sys
destination = sys.argv[1]
mounts = json.load(sys.stdin)
matches = [mount.get("Source", "") for mount in mounts if mount.get("Destination") == destination]
if len(matches) != 1 or not matches[0]:
raise SystemExit(1)
print(matches[0])
' "$destination"
}
resolve_active_runtime() {