-
Notifications
You must be signed in to change notification settings - Fork 3.8k
keepalived: Added track_script option to sync group and fixed print_track_script_indent #29027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
6f43925
6d48739
169fcb7
b956c7f
2983ba4
e527de8
4285957
8848d0b
70f77b5
c2efbec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
|
||
| 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" | ||
| } | ||
|
|
@@ -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 | ||
|
||
| # each member and remove names with not vrrp_instance defined | ||
| for m in $group; do | ||
| vrrp_instance_check "$m" && valid_group="$valid_group $m" | ||
|
|
@@ -347,6 +345,17 @@ vrrp_sync_group() { | |
|
|
||
| print_elems_indent "$1" "$INDENT_1" no_val_smtp_alert no_val_global_tracking | ||
|
|
||
| # Handle track_script list for sync group | ||
| local track_script_val | ||
| config_get track_script_val "$1" track_script | ||
| if [ -n "$track_script_val" ]; then | ||
| printf '%btrack_script {\n' "${INDENT_1}" >> "$KEEPALIVED_CONF" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we not use config_section_open there?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could use config_section_open here but it would mess up the indentation in keepalived.conf. Besides for this is referenced referenced the track_script logic in vrrp_instance
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should extend the config_section_open and config_section_close function, to add a new
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah we can do that. But after this should all the functions that hardcoded this must be changed?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey man you there? @feckert |
||
| for t in $track_script_val; do | ||
| config_foreach print_track_script_indent vrrp_script "$t" "$INDENT_2" | ||
| done | ||
| printf '%b}\n' "${INDENT_1}" >> "$KEEPALIVED_CONF" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we not use config_section_close there? |
||
| fi | ||
|
|
||
| print_notify "GROUP" "$name" "$INDENT_1" notify_backup notify_master \ | ||
| notify_fault notify | ||
|
|
||
|
|
@@ -670,4 +679,3 @@ start_service() { | |
| procd_set_param respawn | ||
| procd_close_instance | ||
| } | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not belongs to this change.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
Uh oh!
There was an error while loading. Please reload this page.