Skip to content

Commit 2fb38e7

Browse files
Merge branch 'jcpunk-show_diff'
2 parents 2c174e1 + 29a2f88 commit 2fb38e7

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

manifests/agent.pp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
# ['trusted_node_data'] - Enable the trusted facts hash
3030
# ['listen'] - If puppet agent should listen for connections
3131
# ['reportserver'] - The server to send transaction reports to.
32+
# ['show_diff'] - Should the reports contain diff output
3233
# ['digest_algorithm'] - The algorithm to use for file digests.
3334
# ['templatedir'] - Template dir, if unset it will remove the setting.
3435
# ['configtimeout'] - How long the client should wait for the configuration to be retrieved before considering it a failure
@@ -95,6 +96,7 @@
9596
$pluginsync = true,
9697
$listen = false,
9798
$reportserver = '$server',
99+
$show_diff = undef,
98100
$digest_algorithm = $::puppet::params::digest_algorithm,
99101
$configtimeout = '2m',
100102
$stringify_facts = undef,
@@ -157,7 +159,7 @@
157159
$startonboot = 'no'
158160
$daemonize = false
159161
}
160-
162+
161163

162164
if ($::osfamily == 'Debian' and $puppet_run_style != 'manual') or ($::osfamily == 'Redhat') {
163165
file { $puppet::params::puppet_defaults:
@@ -307,6 +309,20 @@
307309
value => $puppet_ssldir,
308310
}
309311
}
312+
313+
if $show_diff != undef {
314+
ini_setting {'puppetagentshow_diff':
315+
ensure => present,
316+
section => 'main',
317+
setting => 'show_diff',
318+
value => $show_diff,
319+
}
320+
unless defined(Package[$::puppet::params::ruby_diff_lcs]) {
321+
package {$::puppet::params::ruby_diff_lcs:
322+
ensure => 'latest',
323+
}
324+
}
325+
}
310326

311327
# rundir has no default and must be provided.
312328
ini_setting {'puppetagentrundir':
@@ -536,4 +552,4 @@
536552
value => $serialization_format,
537553
}
538554
}
539-
}
555+
}

manifests/params.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
$rack_package = 'rubygem-rack'
6565
$ruby_dev = 'ruby-devel'
6666
$puppet_facter_package = nil
67+
$ruby_diff_lcs = 'rubygem-diff-lcs'
6768
}
6869
'Suse': {
6970
$puppet_master_package = 'puppet-server'
@@ -74,6 +75,7 @@
7475
$passenger_package = 'rubygem-passenger-apache2'
7576
$rack_package = 'rubygem-rack'
7677
$puppet_facter_package = nil
78+
$ruby_diff_lcs = 'rubygem-diff-lcs'
7779
}
7880
'Debian': {
7981
$puppet_master_package = 'puppetmaster'
@@ -86,6 +88,7 @@
8688
$rack_package = 'librack-ruby'
8789
$ruby_dev = 'ruby-dev'
8890
$puppet_facter_package = nil
91+
$ruby_diff_lcs = 'ruby-diff-lcs'
8992
}
9093
'FreeBSD': {
9194
$puppet_agent_service = 'puppet'

spec/classes/puppet_agent_spec.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,33 @@
557557
}
558558
end
559559
end
560+
describe 'puppetagentshow_diff' do
561+
let(:facts) do
562+
{
563+
:osfamily => 'RedHat',
564+
:operatingsystem => 'RedHat',
565+
:kernel => 'Linux',
566+
:puppetversion => '3.8.0'
567+
}
568+
end
569+
context 'with show_diff set' do
570+
let(:params) do
571+
{
572+
:show_diff => true,
573+
}
574+
end
575+
576+
it{
577+
should contain_ini_setting('puppetagentshow_diff').with(
578+
:ensure => 'present',
579+
:section => 'main',
580+
:setting => 'show_diff',
581+
:value => true,
582+
:path => '/etc/puppet/puppet.conf'
583+
)
584+
}
585+
end
586+
end
560587
describe 'puppetagentstringifyfacts' do
561588
let(:facts) do
562589
{

0 commit comments

Comments
 (0)