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

Conversation

Projects
None yet
2 participants
@chris-rock
Copy link
Contributor

chris-rock commented Apr 25, 2017

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 Apr 26, 2017

files/default/handler/audit_report.rb Outdated
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

This comment has been minimized.

Copy link
@chris-rock

chris-rock Apr 26, 2017

Author Contributor

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.

Add report summary output to chef logs
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>

@chris-rock chris-rock force-pushed the chris-rock/chef-log-summary branch to 1822824 Apr 26, 2017

@arlimus

This comment has been minimized.

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

2 checks passed

DCO This commit has a DCO Signed-off-by
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@arlimus arlimus removed the in progress label Apr 26, 2017

@arlimus arlimus deleted the chris-rock/chef-log-summary branch Apr 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.