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

(#310) {vrrp_,}track_file: Enforce only String datatype #312

Merged
merged 1 commit into from
Mar 12, 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: 4 additions & 5 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1211,18 +1211,17 @@ Default value: `undef`

##### <a name="-keepalived--vrrp--instance--track_file"></a>`track_file`

Data type: `Optional[Array[Stdlib::Absolutepath]]`
Data type: `Optional[Array[String[1]]]`

Define which file trackers to run (array).
Define which file trackers to run. References a track_file block that can be created with keepalived::vrrp::track_file.

Default value: `undef`

##### <a name="-keepalived--vrrp--instance--vrrp_track_file"></a>`vrrp_track_file`

Data type: `Optional[Array[Stdlib::Absolutepath]]`
Data type: `Optional[Array[String[1]]]`

Define which file trackers to run (array).
Deprecated, for keepalived < 2.1.0
Define which file trackers to run. Deprecated, for keepalived < 2.1.0. References a vrrp_track_file block that can be created with keepalived::vrrp::vrrp_track_file.

Default value: `undef`

Expand Down
9 changes: 4 additions & 5 deletions manifests/vrrp/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@
# Define which process trackers to run.
#
# @param track_file
# Define which file trackers to run (array).
# Define which file trackers to run. References a track_file block that can be created with keepalived::vrrp::track_file.
#
# @param vrrp_track_file
# Define which file trackers to run (array).
# Deprecated, for keepalived < 2.1.0
# Define which file trackers to run. Deprecated, for keepalived < 2.1.0. References a vrrp_track_file block that can be created with keepalived::vrrp::vrrp_track_file.
#
# @param track_interface
# Define which interface(s) to monitor.
Expand Down Expand Up @@ -208,8 +207,8 @@
Optional[Variant[String, Sensitive[String]]] $auth_pass = undef,
$track_script = undef,
Optional[Array[String[1]]] $track_process = undef,
Optional[Array[Stdlib::Absolutepath]] $track_file = undef,
Optional[Array[Stdlib::Absolutepath]] $vrrp_track_file = undef,
Optional[Array[String[1]]] $track_file = undef,
Optional[Array[String[1]]] $vrrp_track_file = undef,
$track_interface = undef,
$lvs_interface = undef,
$virtual_ipaddress_int = undef,
Expand Down
15 changes: 13 additions & 2 deletions spec/defines/keepalived_vrrp_instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
'include keepalived'
end

on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) do
facts
os_facts
end

describe 'without parameters' do
Expand Down Expand Up @@ -1420,6 +1420,17 @@
)
}
end

# explicit checks for strings, to prevent future people from enforcing Stdlib::Absolutepath
# See https://github.com/voxpupuli/puppet-keepalived/pull/312 for context
describe 'with track_file and vrrp_track_file' do
let :params do
mandatory_params.merge(track_file: %w[acme foo], vrrp_track_file: %w[bar baz])
end

it { is_expected.to contain_concat__fragment('keepalived.conf_vrrp_instance__NAME_').with_content(%r{track_file \{\n.*acme.*\n.*foo}) }
it { is_expected.to contain_concat__fragment('keepalived.conf_vrrp_instance__NAME_').with_content(%r{vrrp_track_file \{\n.*bar.*\n.*baz}) }
end
end
end
end