inspec-core 4.18.111 → 4.18.114
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/inspec/base_cli.rb +4 -0
- data/lib/inspec/config.rb +7 -0
- data/lib/inspec/reporters/base.rb +22 -0
- data/lib/inspec/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: bee754e41f53d26552da0d2972a28cf55127effcad8c93df678227e99061e676
|
4
|
+
data.tar.gz: 60bd7f57517db8c4e1848ded6ac1fd580b61c29a9b2d24168480b3d62e37557f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c9b443a572925dd12dc846c094256aff3f9fabcc4508ee51ab813f0ec6221088c500ce9a1c77cca693258b48a94212043d2ffd4eb8c49052dbb15bc8d93cc00
|
7
|
+
data.tar.gz: 55c2e45a2ef2e8c9da30a24eb4b09e213320e1d33d2c50e30856754038d75f59576dd76f084a59ee2028920baa37674c0683b426dce6bb3dc06bc5a8c879566b
|
data/README.md
CHANGED
data/lib/inspec/base_cli.rb
CHANGED
@@ -135,6 +135,10 @@ module Inspec
|
|
135
135
|
option :reporter, type: :array,
|
136
136
|
banner: "one two:/output/file/path",
|
137
137
|
desc: "Enable one or more output reporters: cli, documentation, html, progress, json, json-min, json-rspec, junit, yaml"
|
138
|
+
option :reporter_message_truncation, type: :string,
|
139
|
+
desc: "Number of characters to truncate failure messages in report data to (default: no truncation)"
|
140
|
+
option :reporter_backtrace_inclusion, type: :boolean,
|
141
|
+
desc: "Include a code backtrace in report data (default: true)"
|
138
142
|
option :input, type: :array, banner: "name1=value1 name2=value2",
|
139
143
|
desc: "Specify one or more inputs directly on the command line, as --input NAME=VALUE"
|
140
144
|
option :input_file, type: :array,
|
data/lib/inspec/config.rb
CHANGED
@@ -360,6 +360,13 @@ module Inspec
|
|
360
360
|
end
|
361
361
|
|
362
362
|
raise ArgumentError, "The option --reporter can only have a single report outputting to stdout." if stdout_reporters > 1
|
363
|
+
|
364
|
+
# reporter_message_truncation needs to either be the string "ALL", an Integer, or a string representing an integer
|
365
|
+
if (truncation = @merged_options["reporter_message_truncation"])
|
366
|
+
unless truncation == "ALL" || truncation.is_a?(Integer) || truncation.to_i.to_s == truncation
|
367
|
+
raise ArgumentError, "reporter_message_truncation is set to #{truncation}. It must be set to an integer value or ALL to indicate no truncation."
|
368
|
+
end
|
369
|
+
end
|
363
370
|
end
|
364
371
|
|
365
372
|
def validate_plugins!
|
@@ -5,9 +5,31 @@ module Inspec::Reporters
|
|
5
5
|
def initialize(config)
|
6
6
|
@config = config
|
7
7
|
@run_data = config[:run_data]
|
8
|
+
apply_report_resize_options unless @run_data.nil?
|
8
9
|
@output = ""
|
9
10
|
end
|
10
11
|
|
12
|
+
# Apply options such as message truncation and removal of backtraces
|
13
|
+
def apply_report_resize_options
|
14
|
+
runtime_config = Inspec::Config.cached.respond_to?(:final_options) ? Inspec::Config.cached.final_options : {}
|
15
|
+
|
16
|
+
message_truncation = runtime_config[:reporter_message_truncation] || "ALL"
|
17
|
+
trunc = message_truncation == "ALL" ? -1 : message_truncation.to_i
|
18
|
+
include_backtrace = runtime_config[:reporter_backtrace_inclusion].nil? ? true : runtime_config[:reporter_backtrace_inclusion]
|
19
|
+
|
20
|
+
@run_data[:profiles]&.each do |p|
|
21
|
+
p[:controls].each do |c|
|
22
|
+
c[:results]&.map! do |r|
|
23
|
+
r.delete(:backtrace) unless include_backtrace
|
24
|
+
if r.key?(:message) && r[:message] != "" && trunc > -1
|
25
|
+
r[:message] = r[:message][0...trunc] + "[Truncated to #{trunc} characters]"
|
26
|
+
end
|
27
|
+
r
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
11
33
|
def output(str, newline = true)
|
12
34
|
@output << str
|
13
35
|
@output << "\n" if newline
|
data/lib/inspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.18.
|
4
|
+
version: 4.18.114
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef InSpec Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-telemetry
|