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

checking for errors in last_run_report #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

elfranne
Copy link

@elfranne elfranne commented Jul 9, 2021

General

  • Update Changelog following the conventions laid out here

  • Update README with any necessary configuration snippets

  • RuboCop passes

  • Existing tests pass

Purpose

Errors like this:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find resource 'Exec[systemctl-daemon-reload]' for relationship on 'Service[oxidized]' on node node.domain.com

do not appear in the summary file because it never manage to get the catalog, see https://tickets.puppetlabs.com/browse/PUP-9396 and https://tickets.puppetlabs.com/browse/PUP-2089

But they appear in last_run_report.yaml:

sudo head -n 13 /opt/puppetlabs/puppet/cache/state/last_run_report.yaml
--- !ruby/object:Puppet::Transaction::Report
host: node.domain.com
time: '2021-07-09T11:42:36.256429184+00:00'
configuration_version:
transaction_uuid: [long string]
report_format: 11
puppet_version: 6.23.0
status: failed
transaction_completed: false
noop: false
noop_pending: false
environment: production
logs:

The check is not using the YAML library (loads the entire file into memory) because the report file can be quite big. So only the 13 first line are used.

Known Compatibility Issues

None

@elfranne
Copy link
Author

This addition require sudo to open the report file. It requires to add /usr/bin/head -n 13 /opt/puppetlabs/puppet/cache/state/last_run_report.yaml (for Puppet6 and earlier version) to the sudoers file.

Would love to have some feedback on the new sudo requirement:

  • add a breaking change notice ?
  • do not enable the check by default ?
  • split into another check ? ( kinda breaks the idea of a check puppet errors for me )
  • create a check-puppet-errors-v2.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant