Skip to content
Open
9 changes: 3 additions & 6 deletions net/keepalived/files/keepalived.init
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,14 @@ print_track_script_indent() {

local name value weight direction
config_get name "$section" name
[ "$name" != "$curr_track_elem" ] && return 0
if [ -z "$name" ] && return 0

config_get value "$section" value
config_get weight "$section" weight
Comment on lines 216 to 220
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print_track_script_indent() currently has a shell syntax error (if [ -z "$name" ] && return 0) and it no longer filters by curr_track_elem. As a result, every config_foreach ... vrrp_script invocation will print all vrrp_script sections (and, in the current loops, likely print them repeatedly), instead of only the script referenced by the list entry. Replace the invalid if with a normal test, and restore a name != curr_track_elem guard (while still printing the referenced script name).

Copilot uses AI. Check for mistakes.
config_get direction "$section" direction

[ -z "$value" ] && return 0
[ "$direction" != "reverse" ] && [ "$direction" != "noreverse" ] && unset direction

printf '%b%s' "$indent" "$value" >> "$KEEPALIVED_CONF"
printf '%b%s' "$indent" "$name" >> "$KEEPALIVED_CONF"
[ -n "$weight" ] && printf ' weight %s' "$weight ${direction:+${direction}}" >> "$KEEPALIVED_CONF"
printf '\n' >> "$KEEPALIVED_CONF"
}
Expand Down Expand Up @@ -333,7 +331,7 @@ vrrp_sync_group() {
config_get group "$1" group
[ -z "$group" ] && return 0

# Check if we have 'vrrp_instance's defined for
# Check if we have 'vrrp_instance's defined for
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not belongs to this change.
Either new commit or leave it as it is.

# each member and remove names with not vrrp_instance defined
for m in $group; do
vrrp_instance_check "$m" && valid_group="$valid_group $m"
Expand Down Expand Up @@ -670,4 +668,3 @@ start_service() {
procd_set_param respawn
procd_close_instance
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not belongs to this change.
Either new commit or leave it as it is.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cant this be accepted? Or should make changes in another commit to leave it as it is?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said. If this is not related to the change move it to a new commit.
I this case for example keepalived: remove empty line or in the other case keepalived: remove trailing whitespace