Skip to content

Commit

Permalink
Merge pull request #312 from tuxmea/vrrp_track_file
Browse files Browse the repository at this point in the history
(#310) {vrrp_,}track_file: Enforce only String datatype
  • Loading branch information
bastelfreak authored Mar 12, 2024
2 parents f7f4ca7 + 6ac6b31 commit 103b8a8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
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

0 comments on commit 103b8a8

Please sign in to comment.