Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
fix plugin loading for reporter (#441)
Browse files Browse the repository at this point in the history
* load plugins before inspec is loaded.

Signed-off-by: tbugfinder <[email protected]>

* add test/reports to .gitignore

* add reporters to first system as Plugins have to be available before its execution.

Signed-off-by: tbugfinder <[email protected]>

Co-authored-by: tbugfinder <[email protected]>
  • Loading branch information
tbugfinder and tbugfinder authored Feb 25, 2021
1 parent 64df323 commit 415b321
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ terraform.tfstate.d/
test/terraform/Plug Ins/Plug In Directory/
tmp/
vendor/
test/reports/
10 changes: 5 additions & 5 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ suites:
backend: local
controls:
- default
reporter:
- cli
- json:test/reports/inspec/default-attributes.json
- junit:test/reports/inspec/default-attributes.junit.xml
- junit2:test/reports/inspec/default-attributes.junit2.xml
- name: attrs_outputs
backend: local
attrs_outputs:
Expand All @@ -42,11 +47,6 @@ suites:
output_third_output: first_output
controls:
- precedence
reporter:
- cli
- json:test/reports/inspec/attributes.json
- junit:test/reports/inspec/attributes.junit.xml
- junit2:test/reports/inspec/attributes.junit2.xml
- name: backend-ssh
excludes:
- osx
Expand Down
3 changes: 2 additions & 1 deletion lib/kitchen/terraform/inspec_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ def initialize(options:, profile_locations:)
self.host = options.fetch :host do
""
end
self.runner = ::Inspec::Runner.new options.merge logger: ::Inspec::Log.logger

v2_loader = ::Inspec::Plugin::V2::Loader.new
v2_loader.load_all
v2_loader.exit_on_load_error

self.runner = ::Inspec::Runner.new options.merge logger: ::Inspec::Log.logger

profile_locations.each do |profile_location|
runner.add_target profile_location
end
Expand Down

0 comments on commit 415b321

Please sign in to comment.