diff --git a/CHANGELOG.md b/CHANGELOG.md index 7900951..ac92d7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### 1.10.4 / 2018-04-25 +* Fix Inspec report failures +* Fix SSG build failures +* Allow the SSG remediation acceptance test to fail + ### 1.10.3 / 2018-03-23 * Avoid warnings when using `puppet config print` diff --git a/lib/simp/beaker_helpers/inspec.rb b/lib/simp/beaker_helpers/inspec.rb index 497d107..886a293 100644 --- a/lib/simp/beaker_helpers/inspec.rb +++ b/lib/simp/beaker_helpers/inspec.rb @@ -117,11 +117,15 @@ def write_report(report) end end + def process_inspec_results + self.class.process_inspec_results(@results) + end + # Process the results of an InSpec run # # @return [Hash] A Hash of statistics and a formatted report # - def process_inspec_results + def self.process_inspec_results(results) require 'highline' HighLine.colorize_strings @@ -133,7 +137,21 @@ def process_inspec_results :report => [] } - profiles = @results['profiles'] + if results.is_a?(String) + if File.readable?(results) + profiles = JSON.load(File.read(results))['profiles'] + else + fail("Error: Could not read results file at #{results}") + end + elsif results.is_a?(Hash) + profiles = results['profiles'] + else + fail("Error: first argument must be a String path to a file or a Hash") + end + + if !profiles || profiles.empty? + fail("Error: Could not find 'profiles' in the passed results") + end profiles.each do |profile| stats[:report] << "Name: #{profile['name']}" @@ -156,7 +174,7 @@ def process_inspec_results stats[:report] << title_chunks.join("\n") end - if control['results'] + if control['results'] && !control['results'].empty? status = control['results'].first['status'] else status = 'skipped' diff --git a/lib/simp/beaker_helpers/ssg.rb b/lib/simp/beaker_helpers/ssg.rb index 8066a11..2663aa7 100644 --- a/lib/simp/beaker_helpers/ssg.rb +++ b/lib/simp/beaker_helpers/ssg.rb @@ -9,10 +9,11 @@ class SSG end EL_PACKAGES = [ - 'git', + 'PyYAML', 'cmake', - 'openscap-utils', + 'git', 'openscap-python', + 'openscap-utils', 'python-lxml' ] diff --git a/lib/simp/beaker_helpers/version.rb b/lib/simp/beaker_helpers/version.rb index 06fd2e0..727191e 100644 --- a/lib/simp/beaker_helpers/version.rb +++ b/lib/simp/beaker_helpers/version.rb @@ -1,5 +1,5 @@ module Simp; end module Simp::BeakerHelpers - VERSION = '1.10.3' + VERSION = '1.10.4' end