[arvados] created: 2.6.0-587-gafe2449b11

git repository hosting git at public.arvados.org
Thu Sep 7 16:25:57 UTC 2023


        at  afe2449b11c0953b5f6006daf9b43a4659c49b68 (commit)


commit afe2449b11c0953b5f6006daf9b43a4659c49b68
Author: Brett Smith <brett.smith at curii.com>
Date:   Thu Sep 7 12:25:05 2023 -0400

    20934: Add guardrails for old bash in CentOS 7
    
    See comments for full rationale.
    
    Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith at curii.com>

diff --git a/tools/salt-install/common.sh b/tools/salt-install/common.sh
index 7036e116c9..f214522936 100644
--- a/tools/salt-install/common.sh
+++ b/tools/salt-install/common.sh
@@ -38,6 +38,13 @@ for node in "${!NODES[@]}"; do
   # Split the comma-separated roles into an array
   IFS=',' read -ra roles_array <<< "$roles"
 
+  # Workaround for old bash in CentOS 7: if there's nothing in the array,
+  # trying to iterate it trips up `set -u` and raises an unbound variable
+  # error. Short circuit to prevent that.
+  if [[ "${#roles_array[@]}" -eq 0 ]]; then
+    continue
+  fi
+
   for role in "${roles_array[@]}"; do
     if [ -n "${ROLE2NODES[$role]:-}" ]; then
       ROLE2NODES["$role"]="${ROLE2NODES[$role]},$node"

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list