Skip to content

Commit 5e07fd0

Browse files
authored
Merge pull request #365 from bastelfreak/validate
Make config file validation optional
2 parents b024454 + b51ebf0 commit 5e07fd0

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

REFERENCE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ The following parameters are available in the `keepalived` class:
5555
* [`config_dir_mode`](#-keepalived--config_dir_mode)
5656
* [`config_file_mode`](#-keepalived--config_file_mode)
5757
* [`config_validate_cmd`](#-keepalived--config_validate_cmd)
58+
* [`validate_config`](#-keepalived--validate_config)
5859
* [`config_group`](#-keepalived--config_group)
5960
* [`config_owner`](#-keepalived--config_owner)
6061
* [`daemon_group`](#-keepalived--daemon_group)
@@ -122,6 +123,14 @@ Input for the `validate_cmd` param of the keepalived.conf concat fragment.
122123

123124
Default value: `'/usr/sbin/keepalived -l -t -f %'`
124125

126+
##### <a name="-keepalived--validate_config"></a>`validate_config`
127+
128+
Data type: `Boolean`
129+
130+
Boolean to enable/disable the config validation
131+
132+
Default value: `true`
133+
125134
##### <a name="-keepalived--config_group"></a>`config_group`
126135

127136
Data type: `String[1]`

manifests/config.pp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,16 @@
3030
owner => $keepalived::config_owner,
3131
}
3232

33+
$validate_cmd = if $keepalived::validate_config {
34+
$keepalived::config_validate_cmd
35+
} else {
36+
undef
37+
}
3338
concat { "${keepalived::config_dir}/keepalived.conf":
3439
owner => $keepalived::config_owner,
3540
group => $keepalived::config_group,
3641
mode => $keepalived::config_file_mode,
37-
validate_cmd => $keepalived::config_validate_cmd,
42+
validate_cmd => $validate_cmd,
3843
}
3944

4045
concat::fragment { 'keepalived.conf_header':

manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#
1414
# @param config_validate_cmd Input for the `validate_cmd` param of the keepalived.conf concat fragment.
1515
#
16+
# @param validate_config Boolean to enable/disable the config validation
17+
#
1618
# @param config_group
1719
#
1820
# @param config_owner
@@ -67,6 +69,7 @@
6769
Stdlib::Filemode $config_dir_mode = '0755',
6870
Stdlib::Filemode $config_file_mode = '0644',
6971
Stdlib::Absolutepath $config_validate_cmd = '/usr/sbin/keepalived -l -t -f %',
72+
Boolean $validate_config = true,
7073

7174
Array[Stdlib::Absolutepath] $include_external_conf_files = [],
7275

spec/classes/keepalived_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@
180180
)
181181
}
182182
end
183+
184+
describe 'without config validation' do
185+
let :params do
186+
{ validate_config: false }
187+
end
188+
189+
it { is_expected.to contain_concat('/etc/keepalived/keepalived.conf').without_validate_cmd }
190+
end
183191
end
184192
end
185193
end

0 commit comments

Comments
 (0)