Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Facter errors as failures #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions files/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ def metrics_to_hash(report)
end
# fix for Puppet non-resource errors (i.e. failed catalog fetches before falling back to cache)
report_status["failed"] += report.logs.find_all {|l| l.source =~ /Puppet$/ && l.level.to_s == 'err' }.count
if SETTINGS.fetch(:report_facter_errors, true)
report_status["failed"] += report.logs.count {|l| l.source == 'Facter' && l.level.to_s == 'err' }
end

return report_status
end
Expand Down
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
# The timeout to use on HTTP calls in the report processor
# @param report_retry_limit
# The number of times to retry HTTP calls in the report processor
# @param report_facter_errors
# Whether to exclude facter errors from report metrics
# @param puppet_basedir
# The directory used to install the report processor to
# @param use_client_tls_certs
Expand All @@ -54,6 +56,7 @@
Boolean $reports = true,
Integer[0] $reports_timeout = 60,
Integer[0] $report_retry_limit = 1,
Boolean $report_facter_errors = true,
Variant[Enum[''], Stdlib::Absolutepath] $ssl_ca = $puppetserver_foreman::params::client_ssl_ca,
Variant[Enum[''], Stdlib::Absolutepath] $ssl_cert = $puppetserver_foreman::params::client_ssl_cert,
Variant[Enum[''], Stdlib::Absolutepath] $ssl_key = $puppetserver_foreman::params::client_ssl_key,
Expand Down
1 change: 1 addition & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
':timeout: 60',
':report_timeout: 60',
':report_retry_limit: 1',
':report_facter_errors: true',
':threads: null',
])
end
Expand Down
1 change: 1 addition & 0 deletions templates/puppet.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
:timeout: <%= @enc_timeout %>
:report_timeout: <%= @reports_timeout %>
:report_retry_limit: <%= @report_retry_limit %>
:report_facter_errors: <%= @report_facter_errors %>
:threads: null
Loading