Skip to content

Commit 446f2b3

Browse files
committed
Added show_diff param and test
1 parent fbeae85 commit 446f2b3

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

manifests/agent.pp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# ['trusted_node_data'] - Enable the trusted facts hash
2828
# ['listen'] - If puppet agent should listen for connections
2929
# ['reportserver'] - The server to send transaction reports to.
30+
# ['show_diff'] - Should the reports contain diff output
3031
# ['digest_algorithm'] - The algorithm to use for file digests.
3132
# ['templatedir'] - Template dir, if unset it will remove the setting.
3233
# ['configtimeout'] - How long the client should wait for the configuration to be retrieved before considering it a failure
@@ -90,6 +91,7 @@
9091
$pluginsync = true,
9192
$listen = false,
9293
$reportserver = '$server',
94+
$show_diff = undef,
9395
$digest_algorithm = $::puppet::params::digest_algorithm,
9496
$configtimeout = '2m',
9597
$stringify_facts = undef,
@@ -273,6 +275,19 @@
273275
value => $puppet_ssldir,
274276
}
275277
}
278+
if $show_diff != undef {
279+
ini_setting {'puppetagentshow_diff':
280+
ensure => present,
281+
section => 'main',
282+
setting => 'show_diff',
283+
value => $show_diff,
284+
}
285+
unless defined(Package[$::puppet::params::ruby_diff_lcs]) {
286+
package {$::puppet::params::ruby_diff_lcs:
287+
ensure => 'latest',
288+
}
289+
}
290+
}
276291

277292
# rundir has no default and must be provided.
278293
ini_setting {'puppetagentrundir':

manifests/params.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
$passenger_package = 'mod_passenger'
5555
$rack_package = 'rubygem-rack'
5656
$ruby_dev = 'ruby-devel'
57+
$ruby_diff_lcs = 'rubygem-diff-lcs'
5758
}
5859
'Suse': {
5960
$puppet_master_package = 'puppet-server'
@@ -65,6 +66,7 @@
6566
$puppet_ssldir = '/var/lib/puppet/ssl'
6667
$passenger_package = 'rubygem-passenger-apache2'
6768
$rack_package = 'rubygem-rack'
69+
$ruby_diff_lcs = 'rubygem-diff-lcs'
6870
}
6971
'Debian': {
7072
$puppet_master_package = 'puppetmaster'
@@ -78,6 +80,7 @@
7880
$passenger_package = 'libapache2-mod-passenger'
7981
$rack_package = 'librack-ruby'
8082
$ruby_dev = 'ruby-dev'
83+
$ruby_diff_lcs = 'ruby-diff-lcs'
8184
}
8285
'FreeBSD': {
8386
$puppet_agent_service = 'puppet'

spec/classes/puppet_agent_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,32 @@
551551
}
552552
end
553553
end
554+
describe 'puppetagentshow_diff' do
555+
let(:facts) do
556+
{
557+
:osfamily => 'RedHat',
558+
:operatingsystem => 'RedHat',
559+
:kernel => 'Linux'
560+
}
561+
end
562+
context 'with show_diff set' do
563+
let(:params) do
564+
{
565+
:show_diff => true,
566+
}
567+
end
568+
569+
it{
570+
should contain_ini_setting('puppetagentshow_diff').with(
571+
:ensure => 'present',
572+
:section => 'main',
573+
:setting => 'show_diff',
574+
:value => true,
575+
:path => '/etc/puppet/puppet.conf'
576+
)
577+
}
578+
end
579+
end
554580
describe 'puppetagentstringifyfacts' do
555581
let(:facts) do
556582
{

0 commit comments

Comments
 (0)