Skip to content
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

Add support for track_process to vrrp_sync_group #313

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,7 @@ The following parameters are available in the `keepalived::vrrp::sync_group` def
* [`group`](#-keepalived--vrrp--sync_group--group)
* [`notify_script_master`](#-keepalived--vrrp--sync_group--notify_script_master)
* [`track_script`](#-keepalived--vrrp--sync_group--track_script)
* [`track_process`](#-keepalived--vrrp--sync_group--track_process)
* [`notify_script_backup`](#-keepalived--vrrp--sync_group--notify_script_backup)
* [`notify_script_fault`](#-keepalived--vrrp--sync_group--notify_script_fault)
* [`notify_script`](#-keepalived--vrrp--sync_group--notify_script)
Expand Down Expand Up @@ -1599,6 +1600,14 @@ Define which script to run to track service states.

Default value: `[]`

##### <a name="-keepalived--vrrp--sync_group--track_process"></a>`track_process`

Data type: `Array[String]`

Define which process check to run to track processes.

Default value: `[]`

##### <a name="-keepalived--vrrp--sync_group--notify_script_backup"></a>`notify_script_backup`

Data type: `Any`
Expand Down
5 changes: 4 additions & 1 deletion manifests/vrrp/sync_group.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#
# @param notify_script_master Define the notify master script.
#
# @param track_script Define which script to run to track service states.
# @param track_script Define which script to run to track service states.
#
# @param track_process Define which process check to run to track processes.
#
# @param notify_script_backup Define the notify backup script.
#
Expand Down Expand Up @@ -36,6 +38,7 @@
$group,
Optional[Stdlib::Absolutepath] $notify_script_master_rx_lower_pri = undef,
Array[String] $track_script = [],
Array[String] $track_process = [],
$notify_script_master = undef,
$notify_script_backup = undef,
$notify_script_fault = undef,
Expand Down
18 changes: 18 additions & 0 deletions spec/defines/keepalived_vrrp_sync_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@
}
end

describe 'with parameter track_process' do
let(:params) do
{
group: '_GROUP_',
track_process: ['_VALUE_']
}
end

it { is_expected.to create_keepalived__vrrp__sync_group('_NAME_') }

it {
is_expected.to \
contain_concat__fragment('keepalived.conf_vrrp_sync_group__NAME_').with(
'content' => %r!^ track_process {\n _VALUE_!
)
}
end

describe 'with parameter notify_script_master' do
let(:params) do
{
Expand Down
8 changes: 8 additions & 0 deletions templates/vrrp_sync_group.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ vrrp_sync_group <%= @_name %> {
<%- end -%>
}
<%- end -%>
<%- if not @track_process.empty? -%>

track_process {
<%- Array(@track_process).each do |tproc| -%>
<%= tproc %>
<%- end -%>
}
<%- end -%>
<%- if @notify_script -%>
# for ANY state transition.
# "notify" script is called AFTER the
Expand Down