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

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

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

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

jeremiahsnapp opened this issue Jun 16, 2017 · 2 comments
Assignees

Comments

@jeremiahsnapp
Copy link
Contributor

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
Copy link
Contributor

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

@jeremiahsnapp
Copy link
Contributor Author

I just submitted PR #246

@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
Development

No branches or pull requests

2 participants