From b5a48d2c3950ccf1a7e24233b7f42df390d32e3e Mon Sep 17 00:00:00 2001 From: Sanyu Melwani <1154057+sanyu@users.noreply.github.com> Date: Wed, 4 Apr 2018 12:37:38 +1000 Subject: [PATCH 1/3] Allow reports to be disabled --- manifests/agent/config.pp | 2 +- manifests/init.pp | 1 + manifests/params.pp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/manifests/agent/config.pp b/manifests/agent/config.pp index eedf1422..c2c9d94f 100644 --- a/manifests/agent/config.pp +++ b/manifests/agent/config.pp @@ -4,7 +4,7 @@ 'classfile': value => $::puppet::classfile; 'localconfig': value => '$vardir/localconfig'; 'default_schedules': value => false; - 'report': value => true; + 'report': value => $::puppet::report; 'pluginsync': value => $::puppet::pluginsync; 'masterport': value => $::puppet::port; 'environment': value => $::puppet::environment; diff --git a/manifests/init.pp b/manifests/init.pp index 2118e7da..96e902e3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -608,6 +608,7 @@ Variant[String, Array[String]] $client_package = $puppet::params::client_package, Boolean $agent = $puppet::params::agent, Boolean $remove_lock = $puppet::params::remove_lock, + Boolean $report = $puppet::params::report, Variant[String, Boolean] $client_certname = $puppet::params::client_certname, Optional[String] $puppetmaster = $puppet::params::puppetmaster, String $systemd_unit_name = $puppet::params::systemd_unit_name, diff --git a/manifests/params.pp b/manifests/params.pp index a6896dcc..b22d8294 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -15,6 +15,7 @@ $splaylimit = '1800' $runinterval = 1800 $runmode = 'service' + $report = true # Not defined here as the commands depend on module parameter "dir" $cron_cmd = undef From 06b1d2c90bdbbfec25baf25bd4e8b6047c8dc14f Mon Sep 17 00:00:00 2001 From: Sanyu Melwani <1154057+sanyu@users.noreply.github.com> Date: Wed, 4 Apr 2018 13:10:08 +1000 Subject: [PATCH 2/3] Document new "report" option --- manifests/init.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 96e902e3..90ca5341 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -199,6 +199,8 @@ # $dir_group:: Group of the base puppet directory, used when # puppet::server is false. # +# $report:: Send reports to the Puppet Master +# # == puppet::server parameters # # $server:: Should a puppet master be installed as well as the client From 9639dae2f38083cae641863c8ec770ef5776c601 Mon Sep 17 00:00:00 2001 From: Sanyu Melwani <1154057+sanyu@users.noreply.github.com> Date: Thu, 5 Apr 2018 09:31:07 +1000 Subject: [PATCH 3/3] Added test for new 'report' option --- spec/classes/puppet_agent_config_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/classes/puppet_agent_config_spec.rb b/spec/classes/puppet_agent_config_spec.rb index 41b16152..41ac025a 100644 --- a/spec/classes/puppet_agent_config_spec.rb +++ b/spec/classes/puppet_agent_config_spec.rb @@ -29,6 +29,7 @@ end it { should contain_puppet__config__agent('certname').with(facts[:certname]) } + it { should contain_puppet__config__agent('report').with({'value'=>'true'}) } end context 'with runmode => cron', :unless => (facts[:osfamily] == 'Archlinux') do @@ -79,6 +80,14 @@ it { should_not contain_puppet__config__agent('certname') } end + + context 'with report => false' do + let :pre_condition do + 'class { "::puppet": report => false }' + end + + it { should contain_puppet__config__agent('report').with({'value'=>'false'}) } + end end end end