Update etcd testing version
Also ensure init script passes `shellcheck` Updated while looking into https://github.com/rabbitmq/rabbitmq-server/issues/5792
This commit is contained in:
		
							parent
							
								
									8b5d9508d9
								
							
						
					
					
						commit
						7ac6fea9f3
					
				| 
						 | 
					@ -26,14 +26,13 @@ case "$(uname -s)" in
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
etcd_data_dir=${1:-"$tmpdir/etcd/data"}
 | 
					readonly etcd_data_dir="${1:-"$tmpdir/etcd/data"}"
 | 
				
			||||||
pidfile="$etcd_data_dir/etcd.pid"
 | 
					readonly pidfile="$etcd_data_dir/etcd.pid"
 | 
				
			||||||
tcp_port=${2:-2379}
 | 
					readonly tcp_port="${2:-2379}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ETCD_VER=v3.4.6
 | 
					readonly ETCD_VER='v3.5.7'
 | 
				
			||||||
 | 
					readonly GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
 | 
				
			||||||
GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
 | 
					readonly DOWNLOAD_URL=${GITHUB_URL}
 | 
				
			||||||
DOWNLOAD_URL=${GITHUB_URL}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
rm -rf "${tmpdir}/etcd-${ETCD_VER}"
 | 
					rm -rf "${tmpdir}/etcd-${ETCD_VER}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,7 +59,7 @@ rm -rf "$etcd_data_dir"
 | 
				
			||||||
mkdir -p "$etcd_data_dir"
 | 
					mkdir -p "$etcd_data_dir"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# daemonize(1) is installed under this path on Debian
 | 
					# daemonize(1) is installed under this path on Debian
 | 
				
			||||||
PATH=$PATH:/usr/sbin
 | 
					PATH="$PATH:/usr/sbin"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
daemonize -p "$pidfile" -l "${etcd_data_dir}/daemonize_lock" -- "$tmpdir/etcd-${ETCD_VER}/etcd" \
 | 
					daemonize -p "$pidfile" -l "${etcd_data_dir}/daemonize_lock" -- "$tmpdir/etcd-${ETCD_VER}/etcd" \
 | 
				
			||||||
            --data-dir "$etcd_data_dir" --name peer-discovery-0 --initial-advertise-peer-urls http://127.0.0.1:2380 \
 | 
					            --data-dir "$etcd_data_dir" --name peer-discovery-0 --initial-advertise-peer-urls http://127.0.0.1:2380 \
 | 
				
			||||||
| 
						 | 
					@ -71,11 +70,18 @@ daemonize -p "$pidfile" -l "${etcd_data_dir}/daemonize_lock" -- "$tmpdir/etcd-${
 | 
				
			||||||
            --initial-cluster peer-discovery-0=http://127.0.0.1:2380 \
 | 
					            --initial-cluster peer-discovery-0=http://127.0.0.1:2380 \
 | 
				
			||||||
            --initial-cluster-state new
 | 
					            --initial-cluster-state new
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					i=0
 | 
				
			||||||
for seconds in {1..30}; do
 | 
					while [ "$i" -lt 30 ]
 | 
				
			||||||
  "$tmpdir/etcd-${ETCD_VER}/etcdctl" put rabbitmq-ct rabbitmq-ct --dial-timeout=1s && break
 | 
					do
 | 
				
			||||||
  sleep 1
 | 
					    "$tmpdir/etcd-${ETCD_VER}/etcdctl" --endpoints="127.0.0.1:${tcp_port}" put rabbitmq-ct rabbitmq-ct --dial-timeout=1s && break
 | 
				
			||||||
 | 
					    sleep 1
 | 
				
			||||||
 | 
					    i="$((i+1))"
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo ETCD_PID=$(cat "$pidfile")
 | 
					if [ "$i" -ge 30 ]
 | 
				
			||||||
 | 
					then
 | 
				
			||||||
 | 
					    echo '[ERROR] etcd did not start successfully!' 1>&2
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    echo ETCD_PID="$(cat "$pidfile")"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue