Skip to content

Commit

Permalink
Do not pass master_node to master script
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezborder authored Nov 27, 2024
1 parent a7252aa commit 6eb997a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
1 change: 0 additions & 1 deletion resources/providers/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
group 'root'
mode '0755'
retries 2
variables(master_node: get_master(postgresql_vrrp, postgresql_iface, managers))
end

template '/usr/lib/redborder/bin/rb_keepalived_backup_notify_postgresql.sh' do
Expand Down
7 changes: 2 additions & 5 deletions resources/templates/default/notify_backup_postgresql.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

MASTER_NODE=<%= @master_node %>
CURRENT_NODE=$(hostname -s)
LOG_FILE=/tmp/rb_notify_postgresql_backup.log

# Cleaning tmp files
Expand All @@ -11,7 +10,5 @@ rm -f /tmp/rb_notify_postgresql*
date >> "$LOG_FILE"
echo "Executing rb_notify_backup_postgresql" >> "$LOG_FILE"

if [ $CURRENT_NODE != $MASTER_NODE ]; then
echo "Executing rb_sync_from_master.sh $MASTER_NODE" >> "$LOG_FILE"
/usr/lib/redborder/bin/rb_sync_from_master.sh $MASTER_NODE >> "$LOG_FILE"
fi
echo "Executing rb_sync_from_master.sh $MASTER_NODE" >> "$LOG_FILE"
/usr/lib/redborder/bin/rb_sync_from_master.sh $MASTER_NODE >> "$LOG_FILE"
11 changes: 4 additions & 7 deletions resources/templates/default/notify_master_postgresql.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

MASTER_NODE=<%= @master_node %>
CURRENT_NODE=$(hostname -s)
LOG_FILE=/tmp/rb_notify_postgresql_master.log

# Cleaning tmp files
Expand All @@ -11,9 +10,7 @@ rm -f /tmp/rb_notify_postgresql*
date >> "$LOG_FILE"
echo "Executing rb_notify_master_postgresql" >> "$LOG_FILE"

if [ $CURRENT_NODE == $MASTER_NODE ]; then
echo "Promoting to master" >> "$LOG_FILE"
touch /tmp/postgresql.trigger
sed -i '/^primary_conninfo/d' /var/lib/pgsql/data/postgresql.conf
sed -i '/^promote_trigger_file/d' /var/lib/pgsql/data/postgresql.conf
fi
echo "Promoting to master" >> "$LOG_FILE"
touch /tmp/postgresql.trigger
sed -i '/^primary_conninfo/d' /var/lib/pgsql/data/postgresql.conf
sed -i '/^promote_trigger_file/d' /var/lib/pgsql/data/postgresql.conf

0 comments on commit 6eb997a

Please sign in to comment.