inspec-core 4.18.108 → 4.18.111
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inspec/input.rb +9 -9
- data/lib/inspec/rule.rb +1 -1
- 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: e2000adb104d46be6fd057f235fddeea28dd51509d5be6b1fb77552838c90220
|
4
|
+
data.tar.gz: 700c678406bb53c0681e680de4dabb5b6172e1140f73032dff27036293bdf971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c17a414d212c51baff7e7958d404aaa525edd3bd7d081df1a8d20a931e1f0a4d1dfe0d6bb9db4f3c46783c64bcb9071c2ac97631afc2ba969c701de6865602c
|
7
|
+
data.tar.gz: 6a75a992e3369658a4648ad4dee0501c871094b174b6484e6f1f4935474db867169d445ee25e1bee9dc95d524169d45963ba60bffef7e8c72e5dbd8e9af9a9a8
|
data/lib/inspec/input.rb
CHANGED
@@ -98,15 +98,15 @@ module Inspec
|
|
98
98
|
# not been assigned a value. This allows a user to explicitly assign nil
|
99
99
|
# to an input.
|
100
100
|
class NO_VALUE_SET # rubocop: disable Naming/ClassAndModuleCamelCase
|
101
|
-
def initialize(name)
|
101
|
+
def initialize(name, warn_on_create = true)
|
102
102
|
@name = name
|
103
103
|
|
104
104
|
# output warn message if we are in a exec call
|
105
|
-
if Inspec::BaseCLI.inspec_cli_command == :exec
|
105
|
+
if warn_on_create && Inspec::BaseCLI.inspec_cli_command == :exec
|
106
106
|
Inspec::Log.warn(
|
107
107
|
"Input '#{@name}' does not have a value. "\
|
108
|
-
"Use --input-file to provide a value for '#{@name}' or specify a "\
|
109
|
-
"value with `
|
108
|
+
"Use --input-file or --input to provide a value for '#{@name}' or specify a "\
|
109
|
+
"value with `input('#{@name}', value: 'somevalue', ...)`."
|
110
110
|
)
|
111
111
|
end
|
112
112
|
end
|
@@ -277,7 +277,7 @@ module Inspec
|
|
277
277
|
end
|
278
278
|
|
279
279
|
# Determine the current winning value, but don't validate it
|
280
|
-
def current_value
|
280
|
+
def current_value(warn_on_missing = true)
|
281
281
|
# Examine the events to determine highest-priority value. Tie-break
|
282
282
|
# by using the last one set.
|
283
283
|
events_that_set_a_value = events.select(&:value_has_been_set?)
|
@@ -287,7 +287,7 @@ module Inspec
|
|
287
287
|
|
288
288
|
if winning_event.nil?
|
289
289
|
# No value has been set - return special no value object
|
290
|
-
NO_VALUE_SET.new(name)
|
290
|
+
NO_VALUE_SET.new(name, warn_on_missing)
|
291
291
|
else
|
292
292
|
winning_event.value # May still be nil
|
293
293
|
end
|
@@ -315,7 +315,7 @@ module Inspec
|
|
315
315
|
end
|
316
316
|
|
317
317
|
def has_value?
|
318
|
-
!current_value.is_a? NO_VALUE_SET
|
318
|
+
!current_value(false).is_a? NO_VALUE_SET
|
319
319
|
end
|
320
320
|
|
321
321
|
def to_hash
|
@@ -348,7 +348,7 @@ module Inspec
|
|
348
348
|
# skip if we are not doing an exec call (archive/vendor/check)
|
349
349
|
return unless Inspec::BaseCLI.inspec_cli_command == :exec
|
350
350
|
|
351
|
-
proposed_value = current_value
|
351
|
+
proposed_value = current_value(false)
|
352
352
|
if proposed_value.nil? || proposed_value.is_a?(NO_VALUE_SET)
|
353
353
|
error = Inspec::Input::RequiredError.new
|
354
354
|
error.input_name = name
|
@@ -363,7 +363,7 @@ module Inspec
|
|
363
363
|
type_req = type
|
364
364
|
return if type_req == "Any"
|
365
365
|
|
366
|
-
proposed_value = current_value
|
366
|
+
proposed_value = current_value(false)
|
367
367
|
|
368
368
|
invalid_type = false
|
369
369
|
if type_req == "Regexp"
|
data/lib/inspec/rule.rb
CHANGED
@@ -332,7 +332,7 @@ module Inspec
|
|
332
332
|
input_name = @__rule_id # TODO: control ID slugging
|
333
333
|
registry = Inspec::InputRegistry.instance
|
334
334
|
input = registry.inputs_by_profile.dig(__profile_id, input_name)
|
335
|
-
return unless input
|
335
|
+
return unless input && input.has_value? && input.value.is_a?(Hash)
|
336
336
|
|
337
337
|
# An InSpec Input is a datastructure that tracks a profile parameter
|
338
338
|
# over time. Its value can be set by many sources, and it keeps a
|
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.111
|
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-
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-telemetry
|