inspec-core 5.22.40 → 6.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Chef-EULA +9 -0
- data/Gemfile +10 -5
- data/etc/features.sig +6 -0
- data/etc/features.yaml +94 -0
- data/inspec-core.gemspec +14 -5
- data/lib/inspec/backend.rb +2 -0
- data/lib/inspec/base_cli.rb +80 -4
- data/lib/inspec/cached_fetcher.rb +24 -3
- data/lib/inspec/cli.rb +292 -235
- data/lib/inspec/config.rb +24 -11
- data/lib/inspec/dependencies/cache.rb +33 -0
- data/lib/inspec/dependencies/dependency_set.rb +2 -2
- data/lib/inspec/dsl.rb +1 -1
- data/lib/inspec/enhanced_outcomes.rb +1 -0
- data/lib/inspec/errors.rb +5 -0
- data/lib/inspec/exceptions.rb +2 -0
- data/lib/inspec/feature/config.rb +75 -0
- data/lib/inspec/feature/runner.rb +26 -0
- data/lib/inspec/feature.rb +34 -0
- data/lib/inspec/fetcher/git.rb +5 -0
- data/lib/inspec/globals.rb +6 -0
- data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +7 -0
- data/lib/inspec/plugin/v2/plugin_types/streaming_reporter.rb +30 -2
- data/lib/inspec/profile.rb +46 -3
- data/lib/inspec/reporters/cli.rb +1 -1
- data/lib/inspec/reporters.rb +67 -54
- data/lib/inspec/rule.rb +9 -14
- data/lib/inspec/run_data.rb +7 -5
- data/lib/inspec/runner.rb +35 -6
- data/lib/inspec/runner_rspec.rb +12 -9
- data/lib/inspec/secrets/yaml.rb +9 -3
- data/lib/inspec/shell.rb +10 -0
- data/lib/inspec/ui.rb +4 -0
- data/lib/inspec/utils/licensing_config.rb +9 -0
- data/lib/inspec/utils/waivers/csv_file_reader.rb +1 -1
- data/lib/inspec/utils/waivers/excel_file_reader.rb +1 -1
- data/lib/inspec/version.rb +1 -1
- data/lib/inspec/waiver_file_reader.rb +68 -27
- data/lib/inspec.rb +2 -1
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +189 -168
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +10 -3
- data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +1 -0
- data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +23 -21
- data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +15 -13
- data/lib/plugins/inspec-init/lib/inspec-init/cli_resource.rb +15 -13
- data/lib/plugins/inspec-license/README.md +16 -0
- data/lib/plugins/inspec-license/inspec-license.gemspec +6 -0
- data/lib/plugins/inspec-license/lib/inspec-license/cli.rb +26 -0
- data/lib/plugins/inspec-license/lib/inspec-license.rb +14 -0
- data/lib/plugins/inspec-parallel/README.md +27 -0
- data/lib/plugins/inspec-parallel/inspec-parallel.gemspec +6 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/child_status_reporter.rb +61 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/cli.rb +39 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/command.rb +219 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/runner.rb +265 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/base.rb +24 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/silent.rb +7 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/status.rb +124 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/text.rb +23 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb +170 -0
- data/lib/plugins/inspec-parallel/lib/inspec-parallel.rb +18 -0
- data/lib/plugins/inspec-sign/lib/inspec-sign/base.rb +6 -2
- data/lib/plugins/inspec-sign/lib/inspec-sign/cli.rb +11 -4
- data/lib/plugins/inspec-streaming-reporter-progress-bar/lib/inspec-streaming-reporter-progress-bar/streaming_reporter.rb +6 -13
- metadata +53 -13
@@ -0,0 +1,124 @@
|
|
1
|
+
require "highline"
|
2
|
+
|
3
|
+
module InspecPlugins::Parallelism
|
4
|
+
class SuperReporter
|
5
|
+
class Status < InspecPlugins::Parallelism::SuperReporter::Base
|
6
|
+
|
7
|
+
attr_reader :status_by_pid, :slots
|
8
|
+
|
9
|
+
def initialize(job_count, invocations)
|
10
|
+
@status_by_pid = {}
|
11
|
+
@slots = Array.new(job_count)
|
12
|
+
paint_header(job_count, invocations)
|
13
|
+
paint
|
14
|
+
end
|
15
|
+
|
16
|
+
# --------
|
17
|
+
# SuperReporter API
|
18
|
+
# --------
|
19
|
+
def child_spawned(pid, invocation)
|
20
|
+
new_child("spawned", pid, invocation)
|
21
|
+
end
|
22
|
+
|
23
|
+
def child_forked(pid, invocation)
|
24
|
+
new_child("forked", pid, invocation)
|
25
|
+
end
|
26
|
+
|
27
|
+
def child_exited(pid)
|
28
|
+
slots[status_by_pid[pid][:slot]] = "exited"
|
29
|
+
|
30
|
+
status_by_pid[pid][:pct] = 100.0
|
31
|
+
status_by_pid[pid][:slot] = nil
|
32
|
+
status_by_pid[pid][:exit] = $?
|
33
|
+
|
34
|
+
# TODO: consider holding slot in 100 status for UI grace
|
35
|
+
|
36
|
+
paint
|
37
|
+
end
|
38
|
+
|
39
|
+
def child_status_update_line(pid, update_line)
|
40
|
+
control_serial, status, control_count, title = update_line.split("/")
|
41
|
+
percent = 100.0 * control_serial.to_i / control_count.to_i.to_f
|
42
|
+
|
43
|
+
status_by_pid[pid][:pct] = percent
|
44
|
+
status_by_pid[pid][:last_control] = title
|
45
|
+
status_by_pid[pid][:last_status] = status
|
46
|
+
|
47
|
+
paint
|
48
|
+
end
|
49
|
+
|
50
|
+
# --------
|
51
|
+
# Utilities
|
52
|
+
# --------
|
53
|
+
private
|
54
|
+
|
55
|
+
def new_child(how, pid, invocation)
|
56
|
+
# Update status by PID with new info
|
57
|
+
status_by_pid[pid] = {
|
58
|
+
pct: 0.0,
|
59
|
+
inv: invocation,
|
60
|
+
how: how,
|
61
|
+
}
|
62
|
+
|
63
|
+
# Assign first empty slot
|
64
|
+
slots.each_index do |idx|
|
65
|
+
next unless slots[idx].nil? || slots[idx] == "exited"
|
66
|
+
|
67
|
+
slots[idx] = pid
|
68
|
+
status_by_pid[pid][:slot] = idx
|
69
|
+
break
|
70
|
+
end
|
71
|
+
|
72
|
+
# TODO: consider printing log message
|
73
|
+
paint
|
74
|
+
end
|
75
|
+
|
76
|
+
def terminal_width
|
77
|
+
return @terminal_width if @terminal_width
|
78
|
+
|
79
|
+
@highline ||= HighLine.new
|
80
|
+
width = @highline.output_cols.to_i
|
81
|
+
width = 80 if width < 1
|
82
|
+
@terminal_width = width
|
83
|
+
end
|
84
|
+
|
85
|
+
def paint
|
86
|
+
# Determine the width of a slot
|
87
|
+
slot_width = terminal_width / slots.length
|
88
|
+
line = ""
|
89
|
+
# Loop over slots
|
90
|
+
slots.each_index do |idx|
|
91
|
+
if slots[idx].nil?
|
92
|
+
# line += "idle".center(slot_width)
|
93
|
+
# Need to improve UI
|
94
|
+
elsif slots[idx] == "exited"
|
95
|
+
line += "Done".center(slot_width)
|
96
|
+
else
|
97
|
+
pid = slots[idx]
|
98
|
+
with_pid = format("%s: %0.1f%%", pid, status_by_pid[pid][:pct])
|
99
|
+
if with_pid.length <= slot_width - 2
|
100
|
+
line += with_pid.center(slot_width)
|
101
|
+
else
|
102
|
+
line += format("%0.1f%%", status_by_pid[pid][:pct]).center(slot_width)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
print "\r" + (" " * terminal_width) + "\r"
|
108
|
+
print line
|
109
|
+
end
|
110
|
+
|
111
|
+
def paint_header(jobs, invocations)
|
112
|
+
puts "InSpec Parallel".center(terminal_width)
|
113
|
+
puts "Running #{invocations.length} invocations in #{jobs} slots".center(terminal_width)
|
114
|
+
puts "-" * terminal_width
|
115
|
+
slot_width = terminal_width / slots.length
|
116
|
+
slots.each_index do |idx|
|
117
|
+
print "Slot #{idx + 1}".center(slot_width)
|
118
|
+
end
|
119
|
+
puts
|
120
|
+
puts "-" * terminal_width
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module InspecPlugins::Parallelism
|
2
|
+
class SuperReporter
|
3
|
+
class Text < InspecPlugins::Parallelism::SuperReporter::Base
|
4
|
+
def child_spawned(pid, _inv)
|
5
|
+
puts "[#{Time.now.iso8601}] Spawned child PID #{pid}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def child_forked(pid, _inv)
|
9
|
+
puts "[#{Time.now.iso8601}] Forked child PID #{pid}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def child_exited(pid)
|
13
|
+
puts "[#{Time.now.iso8601}] Exited child PID #{pid} status #{$?}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def child_status_update_line(pid, update_line)
|
17
|
+
control_serial, _status, control_count, _title = update_line.split("/")
|
18
|
+
percent = 100.0 * control_serial.to_i / control_count.to_i.to_f
|
19
|
+
puts "[#{Time.now.iso8601}] #{pid} " + format("%.1f%%", percent)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,170 @@
|
|
1
|
+
require "inspec/cli"
|
2
|
+
module InspecPlugins
|
3
|
+
module Parallelism
|
4
|
+
class Validator
|
5
|
+
|
6
|
+
# TODO: make this list dynamic so plugins can self-declare
|
7
|
+
PARALLEL_SAFE_REPORTERS = [
|
8
|
+
"automate", # Performs HTTP transactions, silent on STDOUT
|
9
|
+
"child-status", # Writes dedicated protocol to STDOUT, expected by parent
|
10
|
+
].freeze
|
11
|
+
|
12
|
+
attr_accessor :invocations, :sub_cmd, :thor_options_for_sub_cmd, :aliases_mapping, :cli_options, :config_content, :stdin_config
|
13
|
+
|
14
|
+
def initialize(invocations, cli_options, sub_cmd = "exec")
|
15
|
+
@invocations = invocations
|
16
|
+
@sub_cmd = sub_cmd
|
17
|
+
@thor_options_for_sub_cmd = Inspec::InspecCLI.commands[sub_cmd].options
|
18
|
+
@aliases_mapping = create_aliases_mapping
|
19
|
+
@cli_options = cli_options
|
20
|
+
@config_content = nil
|
21
|
+
@stdin_config = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def validate
|
25
|
+
invocations.each do |invocation_data|
|
26
|
+
invocation_data[:validation_errors] = []
|
27
|
+
|
28
|
+
convert_cli_to_thor_options(invocation_data)
|
29
|
+
check_for_spurious_options(invocation_data)
|
30
|
+
check_for_required_fields(invocation_data)
|
31
|
+
check_for_reporter_options(invocation_data)
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def validate_log_path
|
37
|
+
return [] unless cli_options["log_path"]
|
38
|
+
|
39
|
+
if File.directory?(cli_options["log_path"])
|
40
|
+
[]
|
41
|
+
else
|
42
|
+
[true, "Log path #{cli_options["log_path"]} is not accessible"]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def create_aliases_mapping
|
49
|
+
alias_mapping = {}
|
50
|
+
thor_options_for_sub_cmd.each do |_, sub_cmd_option|
|
51
|
+
aliases = sub_cmd_option.aliases
|
52
|
+
unless aliases.empty?
|
53
|
+
alias_mapping[aliases[0]] = sub_cmd_option.name
|
54
|
+
end
|
55
|
+
end
|
56
|
+
alias_mapping
|
57
|
+
end
|
58
|
+
|
59
|
+
def check_for_spurious_options(invocation_data)
|
60
|
+
# LIMITATION: Assume the first arg is the profile name, and there is exactly one of them.
|
61
|
+
invalid_options = invocation_data[:thor_args][1..-1]
|
62
|
+
invocation_data[:validation_errors].push "No such option: #{invalid_options}" unless invalid_options.empty?
|
63
|
+
end
|
64
|
+
|
65
|
+
def check_for_required_fields(invocation_data)
|
66
|
+
required_fields = thor_options_for_sub_cmd.collect { |_, thor_option| thor_option.name if thor_option.required }.compact
|
67
|
+
option_keys = invocation_data[:thor_opts].keys
|
68
|
+
invocation_data[:thor_opts].keys.map { |key| option_keys.push(aliases_mapping[key.to_sym]) if aliases_mapping[key.to_sym] }
|
69
|
+
if !required_fields.empty? && (option_keys & required_fields).empty?
|
70
|
+
invocation_data[:validation_errors].push "No value provided for required options: #{required_fields}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def check_for_reporter_options(invocation_data)
|
75
|
+
# if no reporter option, that's an error
|
76
|
+
unless invocation_data[:thor_opts].include?("reporter")
|
77
|
+
# Check for config reporter validation only if --reporter option is missing from options file
|
78
|
+
return if check_reporter_options_in_config(invocation_data)
|
79
|
+
|
80
|
+
invocation_data[:validation_errors] << "A --reporter option must be specified for each invocation in the options file"
|
81
|
+
return
|
82
|
+
end
|
83
|
+
|
84
|
+
have_child_status_reporter = false
|
85
|
+
|
86
|
+
# Reporter option is formatted as an array
|
87
|
+
invocation_data[:thor_opts]["reporter"].each do |reporter_spec|
|
88
|
+
reporter_name, file_output = reporter_spec.split(":")
|
89
|
+
|
90
|
+
have_child_status_reporter = true if reporter_name == "child-status"
|
91
|
+
|
92
|
+
# if there is a reporter option, each entry must either write to a file or
|
93
|
+
# else be the special child-status reporter or the automate reporter
|
94
|
+
next if PARALLEL_SAFE_REPORTERS.include?(reporter_name)
|
95
|
+
|
96
|
+
unless file_output
|
97
|
+
invocation_data[:validation_errors] << "The #{reporter_name} reporter requires being directed to a file, like #{reporter_name}:filename.out"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# if there is no child-status reporter, add one to the raw value and the parsed array
|
102
|
+
unless have_child_status_reporter
|
103
|
+
# Eww
|
104
|
+
invocation_data[:thor_opts]["reporter"] << "child-status"
|
105
|
+
invocation_data[:value].gsub!("--reporter ", "--reporter child-status ")
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def check_reporter_options_in_config(invocation_data)
|
110
|
+
config_opts = invocation_data[:thor_opts]["config"] || invocation_data[:thor_opts]["json_config"]
|
111
|
+
cfg_io = check_for_piped_config_from_stdin(config_opts)
|
112
|
+
|
113
|
+
if cfg_io == STDIN
|
114
|
+
# Scenario of using config from STDIN
|
115
|
+
@config_content ||= cfg_io.read
|
116
|
+
else
|
117
|
+
if config_opts.nil?
|
118
|
+
# Scenario of using default config.json file when path not provided
|
119
|
+
default_path = File.join(Inspec.config_dir, "config.json")
|
120
|
+
config_opts = default_path
|
121
|
+
return unless File.exist?(config_opts)
|
122
|
+
elsif !File.exist?(config_opts)
|
123
|
+
invocation_data[:validation_errors] << "Could not read configuration file at #{config_opts}"
|
124
|
+
return
|
125
|
+
end
|
126
|
+
@config_content = File.open(config_opts).read
|
127
|
+
end
|
128
|
+
|
129
|
+
reporter_config = JSON.parse(config_content)["reporter"] unless config_content.nil? || config_content.empty?
|
130
|
+
unless reporter_config
|
131
|
+
invocation_data[:validation_errors] << "Config should have reporter option specified for each invocation which is not using --reporter option in options file"
|
132
|
+
end
|
133
|
+
@config_content
|
134
|
+
end
|
135
|
+
|
136
|
+
def check_for_piped_config_from_stdin(config_opts)
|
137
|
+
return nil unless config_opts
|
138
|
+
return nil unless config_opts == "-"
|
139
|
+
|
140
|
+
@stdin_config ||= STDIN
|
141
|
+
end
|
142
|
+
|
143
|
+
## Utility functions
|
144
|
+
|
145
|
+
# Parse the invocation string using Thor into Thor options
|
146
|
+
# This approach was reverse engineered from studying
|
147
|
+
# https://github.com/rails/thor/blob/ab3b5be455791f4efb79f0efb4f88cc6b59c8ccf/lib/thor/base.rb#L53
|
148
|
+
|
149
|
+
def convert_cli_to_thor_options(invocation_data)
|
150
|
+
invocation_words = invocation_data[:value].split(" ")
|
151
|
+
|
152
|
+
# LIMITATION: this approach is limited to having exactly one profile in the invocation
|
153
|
+
args = [invocation_words.shift] # That is, the profile path
|
154
|
+
|
155
|
+
# Here we're piggybacking on on a hook used by the start() method, and provides the
|
156
|
+
# specifics for the subcommand
|
157
|
+
config = { command_options: thor_options_for_sub_cmd }
|
158
|
+
|
159
|
+
# This performs the parse
|
160
|
+
thor = Inspec::InspecCLI.new(args, invocation_words, config)
|
161
|
+
|
162
|
+
# A hash (with indifferent access) of option names to option config data
|
163
|
+
invocation_data[:thor_opts] = thor.options
|
164
|
+
|
165
|
+
# A list of everything else it could not parse, including the profile
|
166
|
+
invocation_data[:thor_args] = thor.args
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module InspecPlugins
|
2
|
+
module Parallelism
|
3
|
+
class Plugin < ::Inspec.plugin(2)
|
4
|
+
plugin_name :"inspec-parallel"
|
5
|
+
|
6
|
+
cli_command :parallel do
|
7
|
+
require_relative "inspec-parallel/cli"
|
8
|
+
InspecPlugins::Parallelism::CLI
|
9
|
+
end
|
10
|
+
|
11
|
+
streaming_reporter :"child-status" do
|
12
|
+
require_relative "inspec-parallel/child_status_reporter"
|
13
|
+
InspecPlugins::Parallelism::StreamingReporter
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -92,12 +92,16 @@ module InspecPlugins
|
|
92
92
|
Inspec::UI.new.exit(:usage_error)
|
93
93
|
end
|
94
94
|
|
95
|
-
def self.profile_verify(signed_profile_path)
|
95
|
+
def self.profile_verify(signed_profile_path, silent = false)
|
96
96
|
file_to_verify = signed_profile_path
|
97
|
-
puts "Verifying #{file_to_verify}"
|
97
|
+
puts "Verifying #{file_to_verify}" unless silent
|
98
98
|
|
99
99
|
iaf_file = Inspec::IafFile.new(file_to_verify)
|
100
100
|
if iaf_file.valid?
|
101
|
+
# Signed profile verification is called from runner and not from CLI
|
102
|
+
# Do not exit and do not print logs
|
103
|
+
return if silent
|
104
|
+
|
101
105
|
puts "Detected format version '#{iaf_file.version}'"
|
102
106
|
puts "Attempting to verify using key '#{iaf_file.key_name}'"
|
103
107
|
puts "Profile is valid."
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative "base"
|
2
2
|
require "inspec/dist"
|
3
|
+
require "inspec/feature"
|
3
4
|
|
4
5
|
#
|
5
6
|
# Notes:
|
@@ -85,8 +86,10 @@ module InspecPlugins
|
|
85
86
|
option :keydir, type: :string, default: "./",
|
86
87
|
desc: "Directory to search for keys"
|
87
88
|
def generate_keys
|
88
|
-
|
89
|
-
|
89
|
+
Inspec.with_feature("inspec-cli-sign-generate-keys") {
|
90
|
+
puts "Generating keys"
|
91
|
+
InspecPlugins::Sign::Base.keygen(options)
|
92
|
+
}
|
90
93
|
end
|
91
94
|
|
92
95
|
desc "profile PATH", "sign the profile in PATH and generate .iaf artifact."
|
@@ -95,12 +98,16 @@ module InspecPlugins
|
|
95
98
|
option :profile_content_id, type: :string,
|
96
99
|
desc: "UUID of the profile. This will write the profile_content_id in the metadata file if it does not already exist in the metadata file."
|
97
100
|
def profile(profile_path)
|
98
|
-
|
101
|
+
Inspec.with_feature("inspec-cli-sign-profile") {
|
102
|
+
InspecPlugins::Sign::Base.profile_sign(profile_path, options)
|
103
|
+
}
|
99
104
|
end
|
100
105
|
|
101
106
|
desc "verify PATH", "Verify a signed profile .iaf artifact at given path."
|
102
107
|
def verify(signed_profile_path)
|
103
|
-
|
108
|
+
Inspec.with_feature("inspec-cli-sign-verify") {
|
109
|
+
InspecPlugins::Sign::Base.profile_verify(signed_profile_path)
|
110
|
+
}
|
104
111
|
end
|
105
112
|
end
|
106
113
|
end
|
@@ -91,23 +91,20 @@ module InspecPlugins::StreamingReporterProgressBar
|
|
91
91
|
|
92
92
|
set_status_mapping(control_id, status)
|
93
93
|
collect_notifications(notification, control_id, status)
|
94
|
-
|
95
|
-
if control_ended
|
96
|
-
control_outcome = add_enhanced_outcomes(control_id) if enhanced_outcomes
|
97
|
-
show_progress(control_id, title, full_description, control_outcome)
|
98
|
-
end
|
94
|
+
show_progress(control_id, title, full_description) if control_ended?(notification, control_id)
|
99
95
|
end
|
100
96
|
|
101
|
-
def show_progress(control_id, title, full_description
|
97
|
+
def show_progress(control_id, title, full_description)
|
102
98
|
@bar ||= ProgressBar.new(controls_count, :bar, :counter, :percentage)
|
103
99
|
sleep 0.1
|
104
100
|
@bar.increment!
|
105
|
-
@bar.puts format_it(control_id, title, full_description
|
101
|
+
@bar.puts format_it(control_id, title, full_description)
|
106
102
|
rescue StandardError => e
|
107
103
|
raise "Exception in Progress Bar streaming reporter: #{e}"
|
108
104
|
end
|
109
105
|
|
110
|
-
def format_it(control_id, title, full_description
|
106
|
+
def format_it(control_id, title, full_description)
|
107
|
+
control_outcome = control_outcome(control_id)
|
111
108
|
if control_outcome
|
112
109
|
control_status = control_outcome
|
113
110
|
else
|
@@ -121,11 +118,7 @@ module InspecPlugins::StreamingReporterProgressBar
|
|
121
118
|
end
|
122
119
|
end
|
123
120
|
indicator = INDICATORS[control_status]
|
124
|
-
message_to_format =
|
125
|
-
message_to_format += "#{indicator} "
|
126
|
-
message_to_format += "#{control_id.to_s.strip.dup.force_encoding(Encoding::UTF_8)} "
|
127
|
-
message_to_format += "#{title.gsub(/\n*\s+/, " ").to_s.force_encoding(Encoding::UTF_8)} " if title
|
128
|
-
message_to_format += "#{full_description.gsub(/\n*\s+/, " ").to_s.force_encoding(Encoding::UTF_8)} " unless title
|
121
|
+
message_to_format = format_message(indicator, control_id, title, full_description)
|
129
122
|
format_with_color(control_status, message_to_format)
|
130
123
|
rescue Exception => e
|
131
124
|
raise "Exception in show_progress: #{e}"
|
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
|
+
version: 6.6.0
|
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:
|
11
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-telemetry
|
@@ -325,7 +325,7 @@ dependencies:
|
|
325
325
|
version: '1.5'
|
326
326
|
- - "<"
|
327
327
|
- !ruby/object:Gem::Version
|
328
|
-
version: '
|
328
|
+
version: '2.0'
|
329
329
|
type: :runtime
|
330
330
|
prerelease: false
|
331
331
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -335,7 +335,7 @@ dependencies:
|
|
335
335
|
version: '1.5'
|
336
336
|
- - "<"
|
337
337
|
- !ruby/object:Gem::Version
|
338
|
-
version: '
|
338
|
+
version: '2.0'
|
339
339
|
- !ruby/object:Gem::Dependency
|
340
340
|
name: semverse
|
341
341
|
requirement: !ruby/object:Gem::Requirement
|
@@ -368,30 +368,50 @@ dependencies:
|
|
368
368
|
name: train-core
|
369
369
|
requirement: !ruby/object:Gem::Requirement
|
370
370
|
requirements:
|
371
|
-
- - "
|
371
|
+
- - ">="
|
372
372
|
- !ruby/object:Gem::Version
|
373
|
-
version:
|
373
|
+
version: 3.11.0
|
374
374
|
type: :runtime
|
375
375
|
prerelease: false
|
376
376
|
version_requirements: !ruby/object:Gem::Requirement
|
377
377
|
requirements:
|
378
|
-
- - "
|
378
|
+
- - ">="
|
379
|
+
- !ruby/object:Gem::Version
|
380
|
+
version: 3.11.0
|
381
|
+
- !ruby/object:Gem::Dependency
|
382
|
+
name: chef-licensing
|
383
|
+
requirement: !ruby/object:Gem::Requirement
|
384
|
+
requirements:
|
385
|
+
- - ">="
|
386
|
+
- !ruby/object:Gem::Version
|
387
|
+
version: 0.7.5
|
388
|
+
type: :runtime
|
389
|
+
prerelease: false
|
390
|
+
version_requirements: !ruby/object:Gem::Requirement
|
391
|
+
requirements:
|
392
|
+
- - ">="
|
379
393
|
- !ruby/object:Gem::Version
|
380
|
-
version:
|
381
|
-
description:
|
382
|
-
You can use it for integration or even compliance testing. Create fully portable
|
383
|
-
test profiles and use them in your workflow to ensure stability and security. Integrate
|
384
|
-
InSpec in your change lifecycle for local testing, CI/CD, and deployment verification.
|
394
|
+
version: 0.7.5
|
395
|
+
description: |+
|
396
|
+
InSpec provides a framework for creating end-to-end infrastructure tests. You can use it for integration or even compliance testing. Create fully portable test profiles and use them in your workflow to ensure stability and security. Integrate InSpec in your change lifecycle for local testing, CI/CD, and deployment verification.
|
385
397
|
This has local support only. See the `inspec` gem for full support.
|
398
|
+
|
399
|
+
Packaged distributions of Progress® Chef® products obtained from RubyGems are made available pursuant to the Progress Chef EULA at https://www.chef.io/end-user-license-agreement, unless there is an executed agreement in effect between you and Progress that covers the Progress Chef products ("Master Agreement"), in which case the Master Agreement shall govern.
|
400
|
+
|
401
|
+
Source code obtained from the Chef GitHub repository is made available under Apache-2.0, a copy of which is included.
|
402
|
+
|
386
403
|
email:
|
387
404
|
- inspec@chef.io
|
388
405
|
executables: []
|
389
406
|
extensions: []
|
390
407
|
extra_rdoc_files: []
|
391
408
|
files:
|
409
|
+
- Chef-EULA
|
392
410
|
- Gemfile
|
393
411
|
- LICENSE
|
394
412
|
- etc/deprecations.json
|
413
|
+
- etc/features.sig
|
414
|
+
- etc/features.yaml
|
395
415
|
- etc/keys/progress-2022-05-04.pem.pub
|
396
416
|
- etc/plugin_filters.json
|
397
417
|
- inspec-core.gemspec
|
@@ -434,6 +454,9 @@ files:
|
|
434
454
|
- lib/inspec/errors.rb
|
435
455
|
- lib/inspec/exceptions.rb
|
436
456
|
- lib/inspec/expect.rb
|
457
|
+
- lib/inspec/feature.rb
|
458
|
+
- lib/inspec/feature/config.rb
|
459
|
+
- lib/inspec/feature/runner.rb
|
437
460
|
- lib/inspec/fetcher.rb
|
438
461
|
- lib/inspec/fetcher/git.rb
|
439
462
|
- lib/inspec/fetcher/local.rb
|
@@ -710,6 +733,7 @@ files:
|
|
710
733
|
- lib/inspec/utils/install_context.rb
|
711
734
|
- lib/inspec/utils/json_log.rb
|
712
735
|
- lib/inspec/utils/json_profile_summary.rb
|
736
|
+
- lib/inspec/utils/licensing_config.rb
|
713
737
|
- lib/inspec/utils/modulator.rb
|
714
738
|
- lib/inspec/utils/nginx_parser.rb
|
715
739
|
- lib/inspec/utils/object_traversal.rb
|
@@ -794,6 +818,22 @@ files:
|
|
794
818
|
- lib/plugins/inspec-init/templates/resources/basic/libraries/inspec-resource-template.erb
|
795
819
|
- lib/plugins/inspec-init/templates/resources/plural/docs/resource-doc.erb
|
796
820
|
- lib/plugins/inspec-init/templates/resources/plural/libraries/inspec-resource-template.erb
|
821
|
+
- lib/plugins/inspec-license/README.md
|
822
|
+
- lib/plugins/inspec-license/inspec-license.gemspec
|
823
|
+
- lib/plugins/inspec-license/lib/inspec-license.rb
|
824
|
+
- lib/plugins/inspec-license/lib/inspec-license/cli.rb
|
825
|
+
- lib/plugins/inspec-parallel/README.md
|
826
|
+
- lib/plugins/inspec-parallel/inspec-parallel.gemspec
|
827
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel.rb
|
828
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel/child_status_reporter.rb
|
829
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel/cli.rb
|
830
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel/command.rb
|
831
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel/runner.rb
|
832
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/base.rb
|
833
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/silent.rb
|
834
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/status.rb
|
835
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel/super_reporter/text.rb
|
836
|
+
- lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb
|
797
837
|
- lib/plugins/inspec-plugin-manager-cli/README.md
|
798
838
|
- lib/plugins/inspec-plugin-manager-cli/inspec-plugin-manager-cli.gemspec
|
799
839
|
- lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb
|
@@ -837,7 +877,7 @@ files:
|
|
837
877
|
- lib/source_readers/inspec.rb
|
838
878
|
homepage: https://github.com/inspec/inspec
|
839
879
|
licenses:
|
840
|
-
-
|
880
|
+
- LicenseRef-Chef-EULA
|
841
881
|
metadata: {}
|
842
882
|
post_install_message:
|
843
883
|
rdoc_options: []
|