Skip to content

Commit 9ed2f23

Browse files
committed
Handle Facter errors as failures
1 parent 9b0ac1e commit 9ed2f23

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

files/report.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ def metrics_to_hash(report)
121121
end
122122
# fix for Puppet non-resource errors (i.e. failed catalog fetches before falling back to cache)
123123
report_status["failed"] += report.logs.find_all {|l| l.source =~ /Puppet$/ && l.level.to_s == 'err' }.count
124+
unless SETTINGS[:report_ignore_facter_errors]
125+
report_status["failed"] += report.logs.count {|l| l.source == 'Facter' && l.level.to_s == 'err' }
126+
end
124127

125128
return report_status
126129
end

manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
# The timeout to use on HTTP calls in the report processor
3737
# @param report_retry_limit
3838
# The number of times to retry HTTP calls in the report processor
39+
# @param report_ignore_facter_errors
40+
# Whether to exclude facter errors from report metrics
3941
# @param puppet_basedir
4042
# The directory used to install the report processor to
4143
# @param use_client_tls_certs
@@ -54,6 +56,7 @@
5456
Boolean $reports = true,
5557
Integer[0] $reports_timeout = 60,
5658
Integer[0] $report_retry_limit = 1,
59+
Boolean $report_ignore_facter_errors = false,
5760
Variant[Enum[''], Stdlib::Absolutepath] $ssl_ca = $puppetserver_foreman::params::client_ssl_ca,
5861
Variant[Enum[''], Stdlib::Absolutepath] $ssl_cert = $puppetserver_foreman::params::client_ssl_cert,
5962
Variant[Enum[''], Stdlib::Absolutepath] $ssl_key = $puppetserver_foreman::params::client_ssl_key,

spec/classes/init_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
':timeout: 60',
130130
':report_timeout: 60',
131131
':report_retry_limit: 1',
132+
':report_ignore_facter_errors: false',
132133
':threads: null',
133134
])
134135
end

templates/puppet.yaml.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
:timeout: <%= @enc_timeout %>
1313
:report_timeout: <%= @reports_timeout %>
1414
:report_retry_limit: <%= @report_retry_limit %>
15+
:report_ignore_facter_errors: "<%= @report_ignore_facter_errors %>"
1516
:threads: null

0 commit comments

Comments
 (0)