Externalize gluster-wait-peers provision script.
authorMichael Adam <obnox@samba.org>
Thu, 26 Nov 2015 10:06:34 +0000 (11:06 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 26 Nov 2015 10:06:34 +0000 (11:06 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
Vagrantfile
provision/shell/gluster/gluster-wait-peers.sh [new file with mode: 0755]

index f4ee89ddceda73da7e0f67774a6a2c97369c4894..fd1fb65ac7de3be6db24a2c97246b1f337fe80e0 100644 (file)
@@ -202,31 +202,6 @@ ifdown eth1
 ifup eth1
 SCRIPT
 
-
-GLUSTER_WAIT_PEERS_SCRIPT = <<SCRIPT
-set -e
-
-NUM_NODES="$1"
-TIMEOUT=$2
-
-echo "Waiting for $NUM_NODES peers."
-
-for count in $(seq 1 ${TIMEOUT})
-do
-  PEERS=$(gluster pool list | grep -v ^UUID | wc -l)
-  [ "$PEERS" = "$NUM_NODES" ] && {
-    echo "Done waiting: $NUM_NODES peers connected."
-    exit 0
-  } || {
-    sleep 1
-  }
-done
-
-echo "TIMEOUT waiting for $NUM_NODES peers."
-exit 1
-
-SCRIPT
-
 GLUSTER_CREATEVOL_SCRIPT = <<SCRIPT
 #set -e
 
@@ -566,7 +541,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
       end
 
       node.vm.provision "gluster_wait_peers", type: "shell" do |s|
-        s.inline = GLUSTER_WAIT_PEERS_SCRIPT
+        s.path = "provision/shell/gluster/gluster-wait-peers.sh"
         s.args = [ cluster_internal_ips.length, 300]
       end
 
diff --git a/provision/shell/gluster/gluster-wait-peers.sh b/provision/shell/gluster/gluster-wait-peers.sh
new file mode 100755 (executable)
index 0000000..a629df8
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -e
+
+NUM_NODES="$1"
+TIMEOUT=$2
+
+echo "Waiting for $NUM_NODES peers."
+
+for count in $(seq 1 ${TIMEOUT})
+do
+  PEERS=$(gluster pool list | grep -v ^UUID | wc -l)
+  [ "$PEERS" = "$NUM_NODES" ] && {
+    echo "Done waiting: $NUM_NODES peers connected."
+    exit 0
+  } || {
+    sleep 1
+  }
+done
+
+echo "TIMEOUT waiting for $NUM_NODES peers."
+exit 1