Skip to content

Commit

Permalink
refactor: Fix master connection details parsing in MySQL role script
Browse files Browse the repository at this point in the history
  • Loading branch information
pcfreak30 committed Dec 18, 2024
1 parent 2e6c608 commit 0a84be0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/mysql-role.sh
Original file line number Diff line number Diff line change
Expand Up @@ -765,11 +765,15 @@ check_and_configure_replication() {
fi

# Get and validate master connection details
local master_host=$(get_node_hostname "$master_info")
local master_port=$(get_node_port "$master_info")
local master_host
local master_port

# Use the parsed info directly from master_info
master_host=$(echo "$master_info" | jq -r '.host')
master_port=$(echo "$master_info" | jq -r '.port')

# Validate connection details
if [ -z "$master_host" ] || [ -z "$master_port" ]; then
if [ -z "$master_host" ] || [ "$master_host" = "null" ] || [ -z "$master_port" ] || [ "$master_port" = "null" ]; then
log_error "Invalid master connection details - host: ${master_host:-empty}, port: ${master_port:-empty}"
return 1
fi
Expand Down

0 comments on commit 0a84be0

Please sign in to comment.