From 4be59bbe166bd0917660105471e61fd563c6e7c2 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 12 Mar 2024 14:21:07 +0100 Subject: [PATCH 1/2] vrrp::instance: {vrrp_,}track_file: Switch default undef->[] --- REFERENCE.md | 8 ++++---- manifests/vrrp/instance.pp | 4 ++-- templates/vrrp_instance.erb | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index a133f9dc2..4a398e703 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1211,19 +1211,19 @@ Default value: `undef` ##### `track_file` -Data type: `Optional[Array[String[1]]]` +Data type: `Array[String[1]]` Define which file trackers to run. References a track_file block that can be created with keepalived::vrrp::track_file. -Default value: `undef` +Default value: `[]` ##### `vrrp_track_file` -Data type: `Optional[Array[String[1]]]` +Data type: `Array[String[1]]` 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` +Default value: `[]` ##### `track_interface` diff --git a/manifests/vrrp/instance.pp b/manifests/vrrp/instance.pp index d54b4a5f6..686ae977e 100644 --- a/manifests/vrrp/instance.pp +++ b/manifests/vrrp/instance.pp @@ -207,8 +207,8 @@ Optional[Variant[String, Sensitive[String]]] $auth_pass = undef, $track_script = undef, Optional[Array[String[1]]] $track_process = undef, - Optional[Array[String[1]]] $track_file = undef, - Optional[Array[String[1]]] $vrrp_track_file = undef, + Array[String[1]] $track_file = [], + Array[String[1]] $vrrp_track_file = [], $track_interface = undef, $lvs_interface = undef, $virtual_ipaddress_int = undef, diff --git a/templates/vrrp_instance.erb b/templates/vrrp_instance.erb index 48e008b9f..eb1d6f6bc 100644 --- a/templates/vrrp_instance.erb +++ b/templates/vrrp_instance.erb @@ -113,18 +113,18 @@ vrrp_instance <%= @_name %> { <%- end -%> } <%- end -%> - <%- if @track_file -%> + <%- unless @track_file.empty? -%> track_file { - <%- Array(@track_file).each do |track| -%> + <%- @track_file.each do |track| -%> <%= track %> <%- end -%> } <%- end -%> - <%- if @vrrp_track_file -%> + <%- unless @vrrp_track_file.empty? -%> vrrp_track_file { - <%- Array(@vrrp_track_file).each do |track| -%> + <%- @vrrp_track_file.each do |track| -%> <%= track %> <%- end -%> } From 22d156afecb9401d9139a1079d49d4dd430e328c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 12 Mar 2024 14:23:06 +0100 Subject: [PATCH 2/2] vrrp::instance: track_process: Switch default undef->[] --- REFERENCE.md | 4 ++-- manifests/vrrp/instance.pp | 2 +- templates/vrrp_instance.erb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 4a398e703..072c850fc 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1203,11 +1203,11 @@ Default value: `undef` ##### `track_process` -Data type: `Optional[Array[String[1]]]` +Data type: `Array[String[1]]` Define which process trackers to run. -Default value: `undef` +Default value: `[]` ##### `track_file` diff --git a/manifests/vrrp/instance.pp b/manifests/vrrp/instance.pp index 686ae977e..f350a3cf9 100644 --- a/manifests/vrrp/instance.pp +++ b/manifests/vrrp/instance.pp @@ -206,7 +206,7 @@ $auth_type = undef, Optional[Variant[String, Sensitive[String]]] $auth_pass = undef, $track_script = undef, - Optional[Array[String[1]]] $track_process = undef, + Array[String[1]] $track_process = [], Array[String[1]] $track_file = [], Array[String[1]] $vrrp_track_file = [], $track_interface = undef, diff --git a/templates/vrrp_instance.erb b/templates/vrrp_instance.erb index eb1d6f6bc..f56221406 100644 --- a/templates/vrrp_instance.erb +++ b/templates/vrrp_instance.erb @@ -105,10 +105,10 @@ vrrp_instance <%= @_name %> { <%- end -%> } <%- end -%> - <%- if @track_process -%> + <%- unless @track_process.empty? -%> track_process { - <%- Array(@track_process).each do |track| -%> + <%- @track_process.each do |track| -%> <%= track %> <%- end -%> }