From 414342413579747e95e7a5eebc95c18f4c4a5111 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Mon, 19 Jul 2021 09:13:45 -0400
Subject: [PATCH] Various manually-tested fixes for the updater

---
 ci-tools/update-grid-servers | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/ci-tools/update-grid-servers b/ci-tools/update-grid-servers
index 61b4cf47..b11bc6f4 100755
--- a/ci-tools/update-grid-servers
+++ b/ci-tools/update-grid-servers
@@ -38,10 +38,26 @@ update_grid_nodes() {
     gridname=$1
     shift
 
+    case "$gridname" in
+	"production")
+	    grid_dir=./morph/grid/production
+	    domain=private.storage
+	    ;;
+
+	"staging")
+	    grid_dir=./morph/grid/testing
+	    domain=privatestorage-staging.com
+	    ;;
+
+	*)
+	    echo "Unknown grid: ${gridname}"
+	    exit 1
+    esac
+
     # Find the names of all hosts that belong to this grid.  This list includes
     # one extra string, "network", which is morph configuration stuff and we need
     # to filter out later.
-    nodes=$(nix eval --json '(builtins.attrNames (import ./morph/${gridname}/grid.nix))')
+    nodes=$(nix eval --json "(builtins.concatStringsSep \" \" (builtins.attrNames (import $grid_dir/grid.nix)))" | jp --unquoted @)
 
     # Tell every server in the network to update itself.
     for node in ${nodes}; do
@@ -49,8 +65,8 @@ update_grid_nodes() {
 	    # This isn't a server, it's part of the morph configuration.
 	    continue
 	fi
-	update_one_node "${deploy_key}" "${node}"
-    fi
+	update_one_node "${deploy_key}" "${node}.${domain}"
+    done
 }
 
 update_grid_nodes "${DEPLOY_KEY}" "${GRIDNAME}"
-- 
GitLab