inspec-core 4.18.108 → 4.18.111

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07ce3c9c460909bfb27d25c98f2911d44d3319e287e1befb072b0a8d09e22f3d
4
- data.tar.gz: 7158a199c122637211d0a4b9e2e2795b4ec100709a16a1a38be6195d904eaf7d
3
+ metadata.gz: e2000adb104d46be6fd057f235fddeea28dd51509d5be6b1fb77552838c90220
4
+ data.tar.gz: 700c678406bb53c0681e680de4dabb5b6172e1140f73032dff27036293bdf971
5
5
  SHA512:
6
- metadata.gz: e51b5023ca17e20878508e7bb9b7f1abcd8c603676bba0f0a38644d7bd33165700f6fbe251ee61e15beff9c93304b55888bf346ec4228275d57f2201f2dbdcac
7
- data.tar.gz: 473ce96487948f10e81af956690fcb7ef1ca6d0924809d15099ff0919a01a2cc15b0c87ca470a0fb277e8d4086384c281ab4f3b86a6fb61d7b2923be4def5d3f
6
+ metadata.gz: 4c17a414d212c51baff7e7958d404aaa525edd3bd7d081df1a8d20a931e1f0a4d1dfe0d6bb9db4f3c46783c64bcb9071c2ac97631afc2ba969c701de6865602c
7
+ data.tar.gz: 6a75a992e3369658a4648ad4dee0501c871094b174b6484e6f1f4935474db867169d445ee25e1bee9dc95d524169d45963ba60bffef7e8c72e5dbd8e9af9a9a8
@@ -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 `attribute('#{@name}', value: 'somevalue', ...)`."
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"
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Inspec
2
- VERSION = "4.18.108".freeze
2
+ VERSION = "4.18.111".freeze
3
3
  end
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.108
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-04-23 00:00:00.000000000 Z
11
+ date: 2020-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-telemetry