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

Allow the jsonAutomate report to be executed from cli #3285

Merged
merged 2 commits into from
Aug 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/inspec/base_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def self.validate_reporters(reporters)
'documentation',
'html',
'json',
'json-automate',
'json-min',
'json-rspec',
'junit',
Expand Down
6 changes: 5 additions & 1 deletion lib/inspec/reporters.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'inspec/reporters/base'
require 'inspec/reporters/cli'
require 'inspec/reporters/json'
require 'inspec/reporters/json_merged'
require 'inspec/reporters/json_automate'
require 'inspec/reporters/json_min'
require 'inspec/reporters/junit'
require 'inspec/reporters/automate'
Expand All @@ -17,6 +17,10 @@ def self.render(reporter, run_data)
reporter = Inspec::Reporters::CLI.new(config)
when 'json'
reporter = Inspec::Reporters::Json.new(config)
# This reporter is only used for Chef internal. We reserve the
# right to introduce breaking changes to this reporter at any time.
when 'json-automate'
reporter = Inspec::Reporters::JsonAutomate.new(config)
when 'json-min'
reporter = Inspec::Reporters::JsonMin.new(config)
when 'junit'
Expand Down
2 changes: 1 addition & 1 deletion lib/inspec/reporters/automate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'net/http'

module Inspec::Reporters
class Automate < JsonMerged
class Automate < JsonAutomate
def initialize(config)
super(config)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'json'

module Inspec::Reporters
class JsonMerged < Json
class JsonAutomate < Json
def initialize(config)
super(config)
@profiles = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

require 'helper'

describe Inspec::Reporters::JsonMin do
describe Inspec::Reporters::JsonAutomate do
let(:path) { File.expand_path(File.dirname(__FILE__)) }
let(:report) do
data = JSON.parse(File.read(path + '/../mock/reporters/run_data_wrapper.json'), symbolize_names: true)
Inspec::Reporters::JsonMerged.new({ run_data: data })
Inspec::Reporters::JsonAutomate.new({ run_data: data })
end
let(:profiles) { report.report[:profiles] }

Expand Down