Revision 4bb44cff
Added by Simon Peeters about 8 years ago
spec/classes/puppet_config_spec.rb | ||
---|---|---|
" ssldir = #{ssldir}",
|
||
' privatekeydir = $ssldir/private_keys { group = service }',
|
||
' hostprivkey = $privatekeydir/$certname.pem { mode = 640 }',
|
||
" autosign = #{confdir}/autosign.conf { mode = 0664 }",
|
||
' show_diff = false',
|
||
" hiera_config = #{hiera_config}",
|
||
]
|
||
... | ... | |
end
|
||
end
|
||
|
||
describe "when autosign => true" do
|
||
let :pre_condition do
|
||
'class { "::puppet": autosign => true }'
|
||
end
|
||
|
||
it 'should contain puppet.conf [main] with autosign = true' do
|
||
verify_concat_fragment_contents(catalogue, 'puppet.conf+10-main', [
|
||
'[main]',
|
||
' autosign = true',
|
||
])
|
||
end
|
||
end
|
||
|
||
describe 'when autosign => /somedir/custom_autosign, autosign_mode => 664' do
|
||
let :pre_condition do
|
||
"class { '::puppet': autosign => '/somedir/custom_autosign', autosign_mode => '664', }"
|
||
end
|
||
|
||
it 'should contain puppet.conf [main] with autosign = /somedir/custom_autosign { mode = 664 }' do
|
||
verify_concat_fragment_contents(catalogue, 'puppet.conf+10-main', [
|
||
'[main]',
|
||
' autosign = /somedir/custom_autosign { mode = 664 }',
|
||
])
|
||
end
|
||
end
|
||
|
||
describe "when dns_alt_names => ['foo','bar']" do
|
||
let :pre_condition do
|
||
"class { 'puppet': dns_alt_names => ['foo','bar'] }"
|
spec/classes/puppet_server_config_spec.rb | ||
---|---|---|
with_content(/^\s+reports\s+= foreman$/).
|
||
with_content(/^\s+privatekeydir\s+= \$ssldir\/private_keys \{ group = service \}$/).
|
||
with_content(/^\s+hostprivkey\s+= \$privatekeydir\/\$certname.pem \{ mode = 640 \}$/).
|
||
with_content(/^\s+autosign\s+= #{etcdir}\/autosign.conf \{ mode = 0664 \}$/).
|
||
with({}) # So we can use a trailing dot on each with_content line
|
||
|
||
should contain_concat__fragment('puppet.conf+20-agent').
|
||
... | ... | |
with_content(/^\s+ca\s+= true$/).
|
||
with_content(/^\s+ssldir\s+= #{ssldir}$/).
|
||
with_content(/^\s+parser\s+=\s+current$/).
|
||
with_content(/^\s+autosign\s+= #{etcdir}\/autosign.conf \{ mode = 0664 \}$/).
|
||
with({}) # So we can use a trailing dot on each with_content line
|
||
|
||
should contain_concat(conf_file)
|
||
... | ... | |
end
|
||
end
|
||
|
||
describe "when autosign => true" do
|
||
let :pre_condition do
|
||
"class {'puppet':
|
||
server => true,
|
||
autosign => true,
|
||
}"
|
||
end
|
||
|
||
it 'should contain puppet.conf [main] with autosign = true' do
|
||
should contain_concat__fragment('puppet.conf+30-master').
|
||
with_content(/^\s+autosign\s+= true$/).
|
||
with({}) # So we can use a trailing dot on each with_content line
|
||
end
|
||
end
|
||
|
||
describe 'when autosign => /somedir/custom_autosign, autosign_mode => 664' do
|
||
let :pre_condition do
|
||
"class {'puppet':
|
||
server => true,
|
||
autosign => '/somedir/custom_autosign',
|
||
autosign_mode => '664',
|
||
}"
|
||
end
|
||
|
||
it 'should contain puppet.conf [main] with autosign = /somedir/custom_autosign { mode = 664 }' do
|
||
should contain_concat__fragment('puppet.conf+30-master').
|
||
with_content(/^\s+autosign\s+= \/somedir\/custom_autosign { mode = 664 }$/).
|
||
with({}) # So we can use a trailing dot on each with_content line
|
||
end
|
||
end
|
||
|
||
describe 'without foreman' do
|
||
let :pre_condition do
|
||
"class {'puppet':
|
templates/puppet.conf.erb | ||
---|---|---|
privatekeydir = $ssldir/private_keys { group = service }
|
||
hostprivkey = $privatekeydir/$certname.pem { mode = 640 }
|
||
|
||
# Puppet 3.0.x requires this in both [main] and [master] - harmless on agents
|
||
<% autosign = scope.lookupvar('::puppet::autosign') -%>
|
||
<% if !!autosign == autosign -%>
|
||
autosign = <%= autosign %>
|
||
<% else -%>
|
||
autosign = <%= autosign %> { mode = <%= scope.lookupvar('::puppet::autosign_mode') -%> }
|
||
<% end -%>
|
||
show_diff = <%= scope.lookupvar('::puppet::show_diff') %>
|
||
<% if scope.lookupvar('::puppet::server') -%>
|
||
reports = <%= scope.lookupvar('::puppet::server_reports') %>
|
Also available in: Unified diff
remove autosign from [main]