Skip to content

Commit bafa0b5

Browse files
author
Stephen
committed
Merge branch 'add_strict_variables' of https://github.com/yo61/puppetmodule into yo61-add_strict_variables
2 parents 5859adf + 46bfe4b commit bafa0b5

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

manifests/master.pp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
# ['dns_alt_names'] - Comma separated list of alternative DNS names
3434
# ['digest_algorithm'] - The algorithm to use for file digests.
3535
# ['generate_ssl_certs'] - Generate ssl certs (false to disable)
36+
# ['strict_variables'] - Makes the parser raise errors when referencing unknown variables
3637
#
3738
# Requires:
3839
#
@@ -86,6 +87,7 @@
8687
$dns_alt_names = ['puppet'],
8788
$digest_algorithm = $::puppet::params::digest_algorithm,
8889
$generate_ssl_certs = true,
90+
$strict_variables = undef,
8991
) inherits puppet::params {
9092

9193
anchor { 'puppet::master::begin': }
@@ -312,5 +314,14 @@
312314
value => $digest_algorithm,
313315
}
314316

317+
if $strict_variables != undef {
318+
validate_bool(str2bool($strict_variables))
319+
ini_setting {'puppetmasterstrictvariables':
320+
ensure => present,
321+
setting => 'strict_variables',
322+
value => $strict_variables,
323+
}
324+
}
325+
315326
anchor { 'puppet::master::end': }
316327
}

spec/classes/puppet_master_spec.rb

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
:certname => 'test.example.com',
2525
:storeconfigs => 'true',
2626
:storeconfigs_dbserver => 'test.example.com',
27-
:dns_alt_names => ['puppet']
27+
:dns_alt_names => ['puppet'],
28+
:strict_variables => 'true'
2829

2930
}
3031
end
@@ -156,6 +157,13 @@
156157
:path => '/etc/puppet/puppet.conf',
157158
:value => params[:dns_alt_names].join(',')
158159
)
160+
should contain_ini_setting('puppetmasterstrictvariables').with(
161+
:ensure => 'present',
162+
:section => 'master',
163+
:setting => 'strict_variables',
164+
:path => '/etc/puppet/puppet.conf',
165+
:value => params[:strict_variables]
166+
)
159167
should contain_anchor('puppet::master::begin').with_before(
160168
['Class[Puppet::Passenger]', 'Class[Puppet::Storeconfigs]']
161169
)
@@ -185,7 +193,8 @@
185193
:certname => 'test.example.com',
186194
:storeconfigs => 'true',
187195
:storeconfigs_dbserver => 'test.example.com',
188-
:dns_alt_names => ['puppet']
196+
:dns_alt_names => ['puppet'],
197+
:strict_variables => 'true'
189198

190199
}
191200
end
@@ -315,6 +324,13 @@
315324
:path => '/etc/puppet/puppet.conf',
316325
:value => params[:dns_alt_names].join(',')
317326
)
327+
should contain_ini_setting('puppetmasterstrictvariables').with(
328+
:ensure => 'present',
329+
:section => 'master',
330+
:setting => 'strict_variables',
331+
:path => '/etc/puppet/puppet.conf',
332+
:value => params[:strict_variables]
333+
)
318334
should contain_anchor('puppet::master::begin').with_before(
319335
['Class[Puppet::Passenger]', 'Class[Puppet::Storeconfigs]']
320336
)

0 commit comments

Comments
 (0)