Switched from profile_id to __profile_id per feedback.

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2019-12-12 15:52:08 -08:00
parent 6426feeeb4
commit a0ffa67b71

View file

@ -16,7 +16,6 @@ module Inspec
attr_reader :__waiver_data
attr_accessor :resource_dsl
attr_reader :__profile_id
alias profile_id __profile_id
def initialize(id, profile_id, resource_dsl, opts, &block)
@impact = nil
@ -176,23 +175,23 @@ module Inspec
def input(input_name, options = {})
if options.empty?
# Simply an access, no event here
Inspec::InputRegistry.find_or_register_input(input_name, profile_id).value
Inspec::InputRegistry.find_or_register_input(input_name, __profile_id).value
else
options[:priority] ||= 20
options[:provider] = :inline_control_code
evt = Inspec::Input.infer_event(options)
Inspec::InputRegistry.find_or_register_input(input_name, profile_id, event: evt).value
Inspec::InputRegistry.find_or_register_input(input_name, __profile_id, event: evt).value
end
end
# Find the Input object, but don't collapse to a value.
# Will return nil on a miss.
def input_object(input_name)
Inspec::InputRegistry.find_or_register_input(input_name, profile_id)
Inspec::InputRegistry.find_or_register_input(input_name, __profile_id)
end
def attribute(name, options = {})
Inspec.deprecate(:attrs_dsl, "Input name: #{name}, Profile: #{profile_id}")
Inspec.deprecate(:attrs_dsl, "Input name: #{name}, Profile: #{__profile_id}")
input(name, options)
end
@ -332,7 +331,7 @@ module Inspec
def __apply_waivers
input_name = @__rule_id # TODO: control ID slugging
registry = Inspec::InputRegistry.instance
input = registry.inputs_by_profile.dig(@__profile_id, input_name)
input = registry.inputs_by_profile.dig(__profile_id, input_name)
return unless input
# An InSpec Input is a datastructure that tracks a profile parameter