File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/env bash
22
3+ if [ ! -f /opt/bin/jq ]; then
4+ echo " /opt/bin/jq is missing. Downloading..."
5+ curl -sSL -o /opt/bin/jq http://stedolan.github.io/jq/download/linux64/jq
6+ chmod +x /opt/bin/jq
7+ fi
8+
9+ # obtain the etcd node members and check that at least there is three
10+ ETCD_NODES=$( curl -s http://localhost:4001/v2/members | jq ' .[] | .[].peerURLs | length' | wc -l)
11+ if test $ETCD_NODES -lt 3; then
12+ echo " etcd is not working correctly. Verify the etcd cluster is running before the execution of this script."
13+ fi
14+
315echo " Obtaining IP addresses of the nodes in the cluster..."
416MACHINES_IP=$( fleetctl list-machines --fields=ip --no-legend | awk -vORS=, ' { print $1 }' | sed ' s/,$/\n/' )
517
@@ -59,7 +71,7 @@ echo "Enabling iptables service"
5971sudo systemctl enable iptables-restore.service
6072
6173# Flush custom rules before the restore (so this script is idempotent)
62- sudo /usr/sbin/iptables -F Firewall-INPUT
74+ sudo /usr/sbin/iptables -F Firewall-INPUT 2> /dev/null
6375
6476echo " Loading custom iptables firewall"
6577sudo /sbin/iptables-restore --noflush /var/lib/iptables/rules-save
You can’t perform that action at this time.
0 commit comments