From 287efe373d37624cb91e1199f45f5206643ba1e1 Mon Sep 17 00:00:00 2001 From: damage Date: Thu, 2 Apr 2026 18:53:00 +0200 Subject: [PATCH] fix: max_by had wrong exp and just returned last from array --- app/proxmox_backup_server/pbs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/proxmox_backup_server/pbs.sh b/app/proxmox_backup_server/pbs.sh index 2a02d4e..52cd127 100755 --- a/app/proxmox_backup_server/pbs.sh +++ b/app/proxmox_backup_server/pbs.sh @@ -14,7 +14,7 @@ for datastore in $(echo "${datastores}" |jq --raw-output '.data[].store'); do for namespace in $(echo "${namespaces}" |jq --raw-output '.data[].ns'); do # group backups by backup-type and backup-id, only get the backup of each group (thus the map) with max backup-time and add datastore and namespace to each backup - temp=$(wget --header="Authorization: PBSAPIToken=${TOKENID}:${TOKENSECRET}" --content-on-error -q -O - "https://${HOST}:${PORT}/api2/json/admin/datastore/${datastore}/snapshots?ns=${namespace}" |jq ".data |group_by([.\"backup-type\", .\"backup-id\"]) |map(max_by(\".backup-time\")) |map(.datastore |= \"${datastore}\") |map(.namespace |= \"${namespace}\")") + temp=$(wget --header="Authorization: PBSAPIToken=${TOKENID}:${TOKENSECRET}" --content-on-error -q -O - "https://${HOST}:${PORT}/api2/json/admin/datastore/${datastore}/snapshots?ns=${namespace}" |jq ".data |group_by([.\"backup-type\", .\"backup-id\"]) |map(max_by(.\"backup-time\")) |map(.datastore |= \"${datastore}\") |map(.namespace |= \"${namespace}\")") # remove array symbols ([ and ]) temp="${temp:1}"