From f9bb81d55b96def2f71bebd46ba34e1c9e7bf2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jim=C3=A9nez=20Cabrera?= Date: Tue, 14 Jul 2026 15:28:50 +0100 Subject: [PATCH] [bitnami/valkey-cluster] Migrate legacy nodes.sh format in valkey_cluster_update_ips (#95158) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Jiménez Cabrera <6353928+jkfran@users.noreply.github.com> Co-authored-by: Francisco Jiménez Cabrera <6353928+jkfran@users.noreply.github.com> --- .../rootfs/opt/bitnami/scripts/libvalkeycluster.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bitnami/valkey-cluster/9.1/debian-12/rootfs/opt/bitnami/scripts/libvalkeycluster.sh b/bitnami/valkey-cluster/9.1/debian-12/rootfs/opt/bitnami/scripts/libvalkeycluster.sh index 8cf144671e3d..695db7c1eeac 100644 --- a/bitnami/valkey-cluster/9.1/debian-12/rootfs/opt/bitnami/scripts/libvalkeycluster.sh +++ b/bitnami/valkey-cluster/9.1/debian-12/rootfs/opt/bitnami/scripts/libvalkeycluster.sh @@ -218,6 +218,18 @@ valkey_cluster_update_ips() { printf "%s=\"%s\"\n" "$key" "${host_2_ip_array[$key]}" >> "${VALKEY_DATA_DIR}/nodes.sh" done else + info "Updating Valkey cluster IPs" + # Safeguard to detect old format on nodes.sh + if grep -q "declare -A host_2_ip_array=" "${VALKEY_DATA_DIR}/nodes.sh"; then + # Transform the old format to the new format in a sub-shell + ( + source "${VALKEY_DATA_DIR}/nodes.sh" + for host in "${!host_2_ip_array[@]}"; do + echo "${host}=\"${host_2_ip_array[$host]}\"" + done + ) > "${VALKEY_DATA_DIR}/nodes.sh.new" + mv "${VALKEY_DATA_DIR}/nodes.sh.new" "${VALKEY_DATA_DIR}/nodes.sh" + fi # The cluster was already started, let's read hosts and IPs from the nodes.sh file while IFS= read -r line || [[ -n "$line" ]]; do # Skip blank lines and shell comments