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

Add report summary output to chef logs #210

Merged
merged 1 commit into from
Apr 26, 2017
Merged

Conversation

chris-rock
Copy link
Contributor

Description

This PR introduces a info log message to chef client runs. This makes it a lot easier to see if InSpec was properly executed. A sample output looks like:

[2017-04-26T00:13:42+02:00] WARN: Format is json-min
[2017-04-26T00:13:42+02:00] INFO: Initialize InSpec 1.21.0
[2017-04-26T00:13:42+02:00] INFO: Running tests from: [{:name=>"ssh", :compliance=>"base/ssh"}]
[2017-04-26T00:13:43+02:00] INFO: Summary: 13 successful, 56 failures, 0 skipped in 0.116041 s
[2017-04-26T00:13:43+02:00] INFO: Reporting to json-file
[2017-04-26T00:13:43+02:00] WARN: Writing report to file.

Issues Resolved

It may address #207

@chris-rock chris-rock force-pushed the chris-rock/chef-log-summary branch from 9695245 to f6b7a9e Compare April 26, 2017 07:58
unless r.nil? && ['json-min', 'json'].include(opts['format'])
time = 0
time = r[:statistics][:duration] unless r[:statistics].nil?
passed_controls = r[:controls].select { |c| c[:status] == 'passed' }.size
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I was running into the issue that controls are available in full reports, too. See inspec/inspec#1564. Since this is deprecated, we need to adapt this implementation.

Signed-off-by: Christoph Hartmann <[email protected]>
@chris-rock chris-rock force-pushed the chris-rock/chef-log-summary branch from f6b7a9e to 1822824 Compare April 26, 2017 10:26
@arlimus
Copy link
Contributor

arlimus commented Apr 26, 2017

Thank you for improving this calculation, great improvement!

@arlimus arlimus merged commit da4ce7d into master Apr 26, 2017
@arlimus arlimus deleted the chris-rock/chef-log-summary branch April 26, 2017 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants