Skip to content

Commit

Permalink
fix patroni-leader-check
Browse files Browse the repository at this point in the history
  • Loading branch information
kreatoo committed Oct 13, 2024
1 parent f1b8615 commit 6068ba9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/monocloud/patroni-leader-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function parse_config_patronileadercheck() {
CONFIG_PATH_PATRONILEADERCHECK="patroni-leader-check"
export REQUIRED=true

CF_API_TOKEN=$(yaml .cloudflare.token $CONFIG_PATH_PATRONILEADERCHECK)
export CF_API_TOKEN=$(yaml .cloudflare.token $CONFIG_PATH_PATRONILEADERCHECK)

CF_ZONE_NAME=$(yaml .cloudflare.zone_name $CONFIG_PATH_PATRONILEADERCHECK)

Expand All @@ -32,6 +32,8 @@ function parse_config_patronileadercheck() {

MASTER_NAME=$(yaml .redis.master_name $CONFIG_PATH_PATRONILEADERCHECK "mymaster")

record_id=$(yaml .cloudflare.record_id $CONFIG_PATH_PATRONILEADERCHECK)

}

parse_config_patronileadercheck
Expand Down Expand Up @@ -84,11 +86,9 @@ if [ "$response_code" -eq 200 ]; then
monokit alarm send --message "[patroni-leader-check] [:check:] Redis promoted to master on hostname $(hostname) with redis address $REDIS_ADDR"


current_record=$(host -ta "$DOMAIN" 1.1.1.1 | tail -1 | awk '{print $4}')
record_id=$(echo "$current_record" | awk '{print $1}')
current_ip=$(echo "$current_record" | awk '{for(i=1;i<=NF;i++) if($i ~ /^10\./) print $i; exit}')
current_ip=$(host -ta "$DOMAIN" 1.1.1.1 | tail -1 | awk '{print $4}')

echo "Extracted Record ID: '$record_id'"
echo "Record ID: '$record_id'"
echo "Current IP: '$current_ip'"

new_ip="$PATRONI_IP"
Expand Down

0 comments on commit 6068ba9

Please sign in to comment.