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

json-file reporter saves ruby hash instead of JSON #244

Closed
jeremiahsnapp opened this Issue Jun 16, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@jeremiahsnapp
Contributor

jeremiahsnapp commented Jun 16, 2017

Cookbook version

4.0.0

Chef-client version

13.1.31

Platform Details

Ubuntu 14.04.5

Scenario:

Trying to use json-file reporter.

Steps to Reproduce:

{
  "audit": {
    "reporter": ["chef-server-automate", "json-file"],
    "insecure": true,
    "profiles": [
      {
        "name": "linux",
        "compliance": "admin/linux"
      }
    ]
  }
}

Expected Result:

The file saved to disk should contain the report in JSON format.

Actual Result:

The file saved to disk contains the ruby hash of the report.

Reason:

The bug is in this line.

https://github.com/chef-cookbooks/audit/blob/v4.0.0/libraries/reporters/json_file.rb#L19

It should be changed to the following.

      json_file.puts(JSON.generate(report))
@chris-rock

This comment has been minimized.

Collaborator

chris-rock commented Jun 16, 2017

@jeremiahsnapp Thank you for reporting this issue! Are you opening a PR to fix this?

@jeremiahsnapp

This comment has been minimized.

Contributor

jeremiahsnapp commented Jun 16, 2017

I just submitted PR #246

@chris-rock chris-rock closed this Jun 19, 2017

@chris-rock chris-rock self-assigned this Jun 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment