simp-beaker-helpers 1.10.3 → 1.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/simp/beaker_helpers/inspec.rb +21 -3
- data/lib/simp/beaker_helpers/ssg.rb +3 -2
- data/lib/simp/beaker_helpers/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48ce171f013dbe8a52759ba1916ae8d0a938725fbb7e0a99ec665d7e4f0025e0
|
4
|
+
data.tar.gz: 9e641d1cec4789762b4edb28e16491a0775bb0e035e83f3e1df220615579c791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a886b52d44503956347df34dcb439692d03e0bc83f7f4840569db331b8419cdf9bca07bfa9b993e1c9d0713e47714aaeb51e42b9766eae9a3548beffdefb809d
|
7
|
+
data.tar.gz: 4a8a263a155948001c12f8f5d1d8fe8b15c8bca2a36f57d6009a39ec48a3466058732482daf7a70cb0a6510cb97ab3a97bc643b2cf07e722ffa73138e28d6441
|
data/CHANGELOG.md
CHANGED
@@ -117,11 +117,15 @@ module Simp::BeakerHelpers
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
+
def process_inspec_results
|
121
|
+
self.class.process_inspec_results(@results)
|
122
|
+
end
|
123
|
+
|
120
124
|
# Process the results of an InSpec run
|
121
125
|
#
|
122
126
|
# @return [Hash] A Hash of statistics and a formatted report
|
123
127
|
#
|
124
|
-
def process_inspec_results
|
128
|
+
def self.process_inspec_results(results)
|
125
129
|
require 'highline'
|
126
130
|
|
127
131
|
HighLine.colorize_strings
|
@@ -133,7 +137,21 @@ module Simp::BeakerHelpers
|
|
133
137
|
:report => []
|
134
138
|
}
|
135
139
|
|
136
|
-
|
140
|
+
if results.is_a?(String)
|
141
|
+
if File.readable?(results)
|
142
|
+
profiles = JSON.load(File.read(results))['profiles']
|
143
|
+
else
|
144
|
+
fail("Error: Could not read results file at #{results}")
|
145
|
+
end
|
146
|
+
elsif results.is_a?(Hash)
|
147
|
+
profiles = results['profiles']
|
148
|
+
else
|
149
|
+
fail("Error: first argument must be a String path to a file or a Hash")
|
150
|
+
end
|
151
|
+
|
152
|
+
if !profiles || profiles.empty?
|
153
|
+
fail("Error: Could not find 'profiles' in the passed results")
|
154
|
+
end
|
137
155
|
|
138
156
|
profiles.each do |profile|
|
139
157
|
stats[:report] << "Name: #{profile['name']}"
|
@@ -156,7 +174,7 @@ module Simp::BeakerHelpers
|
|
156
174
|
stats[:report] << title_chunks.join("\n")
|
157
175
|
end
|
158
176
|
|
159
|
-
if control['results']
|
177
|
+
if control['results'] && !control['results'].empty?
|
160
178
|
status = control['results'].first['status']
|
161
179
|
else
|
162
180
|
status = 'skipped'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simp-beaker-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Tessmer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: beaker
|