From da729cecec11526bc92dc4404c83bb6adbd64b96 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 8 Sep 2026 13:15:40 +0200 Subject: [PATCH] fix(sys-svc-rdbms): resolve a bind volume's device, not its unmounted _data docker mounts a bind-backed volume's device only while a container holds it, so .Mountpoint is an empty _data whenever the stack is down - which is exactly when the credential realign runs. The script then failed its 'test -f' and exited 0, reporting ok instead of changed, so a rotated password never reached the app's persisted config. Read .Options.device when .Options.o declares a bind; compose volumes carry no .Options and keep the .Mountpoint path. Affects every role shipping tasks/utils/patch/db_credentials.yml: friendica, joomla, kix, matomo, moodle, nextcloud, suitecrm. Co-Authored-By: Claude Opus 5 (1M context) --- .../files/shell/patch_persisted_password.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/sys-svc-rdbms/files/shell/patch_persisted_password.sh b/roles/sys-svc-rdbms/files/shell/patch_persisted_password.sh index 1336131dbf..f7ab9d7ab3 100755 --- a/roles/sys-svc-rdbms/files/shell/patch_persisted_password.sh +++ b/roles/sys-svc-rdbms/files/shell/patch_persisted_password.sh @@ -22,8 +22,13 @@ set -euo pipefail container volume ls -q -f "name=^${PATCH_VOLUME}$" | grep -q . || exit 0 -mountpoint="$(container volume inspect --format '{{.Mountpoint}}' "$PATCH_VOLUME")" -config="${mountpoint}/${PATCH_CONFIG_REL}" +opts="$(container volume inspect --format '{{if .Options}}{{.Options.o}}{{end}}' "$PATCH_VOLUME")" +case "$opts" in +*bind*) data_dir="$(container volume inspect --format '{{.Options.device}}' "$PATCH_VOLUME")" ;; +*) data_dir="$(container volume inspect --format '{{.Mountpoint}}' "$PATCH_VOLUME")" ;; +esac + +config="${data_dir}/${PATCH_CONFIG_REL}" test -f "$config" || exit 0 expression="${PATCH_EXPRESSION//@PASSWORD@/$PATCH_PASSWORD}"