#!/usr/bin/env bash set -e set -o pipefail while true; do if /usr/bin/docker exec mariadb-db-1 mysql -p"$(puppet lookup --render-as s mariadb_root_password 2>/dev/null)" -e "show status like 'wsrep_cluster_status';" | grep -q Primary; then exit 0 fi sleep 3 done