Skip to content

Commit 1056b3d

Browse files
committed
Change system notify to warning function
Prior to this commit, the system manifest produced a notify event at warning level if sysstat was unmanaged and uninstalled. This caused issues in idempotency testing, so this commit changes it to a WARN entry in the server logs that does not produce an event.
1 parent 1d9b1f2 commit 1056b3d

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

manifests/system.pp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@
6666
contain puppet_metrics_collector::system::cpu
6767
contain puppet_metrics_collector::system::memory
6868
contain puppet_metrics_collector::system::processes
69-
} else {
70-
notify { 'sysstat_missing_warning':
71-
message => 'System collection disabled. Set `puppet_metrics_collector::system::manage_sysstat: true` to enable system metrics',
72-
loglevel => warning,
73-
}
69+
}
70+
else {
71+
warning('System collection disabled. Set `puppet_metrics_collector::system::manage_sysstat: true` to enable system metrics')
7472
}
7573

7674
if $facts['virtual'] == 'vmware' {

spec/classes/puppet_metrics_collector_system_spec.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
let(:pre_condition) { 'package{"sysstat": }' }
1212
let(:facts) { { puppet_metrics_collector: { have_sysstat: true, have_systemd: true } } }
1313

14-
it { is_expected.not_to contain_notify('sysstat_missing_warning') }
1514
it { is_expected.to contain_class('puppet_metrics_collector::system::cpu') }
1615
it { is_expected.to contain_class('puppet_metrics_collector::system::memory') }
1716
it { is_expected.to contain_class('puppet_metrics_collector::system::processes') }
@@ -21,15 +20,13 @@
2120
let(:params) { { manage_sysstat: true } }
2221
let(:facts) { { puppet_metrics_collector: { have_sysstat: false, have_systemd: true } } }
2322

24-
it { is_expected.not_to contain_notify('sysstat_missing_warning') }
2523
it { is_expected.to contain_package('sysstat') }
2624
it { is_expected.to contain_class('puppet_metrics_collector::system::cpu') }
2725
it { is_expected.to contain_class('puppet_metrics_collector::system::memory') }
2826
it { is_expected.to contain_class('puppet_metrics_collector::system::processes') }
2927
end
3028

3129
context 'not installed and not managed' do
32-
it { is_expected.to contain_notify('sysstat_missing_warning') }
3330
it { is_expected.not_to contain_package('sysstat') }
3431
it { is_expected.not_to contain_class('puppet_metrics_collector::system::cpu') }
3532
it { is_expected.not_to contain_class('puppet_metrics_collector::system::memory') }

0 commit comments

Comments
 (0)