diff --git a/lib/inspec/control_eval_context.rb b/lib/inspec/control_eval_context.rb index dc2b994fc..c802ef372 100644 --- a/lib/inspec/control_eval_context.rb +++ b/lib/inspec/control_eval_context.rb @@ -27,7 +27,7 @@ module Inspec # allow attributes to be accessed within control blocks define_method :attribute do |name| - Inspec::AttributeRegistry.find_attribute(name, profile_id).value + Inspec::InputRegistry.find_input(name, profile_id).value end # Support for Control DSL plugins. @@ -167,12 +167,12 @@ module Inspec profile_context_owner.register_rule(control, &block) unless control.nil? end - # method for attributes; import attribute handling + # method for inputs; import input handling define_method :attribute do |name, options = nil| if options.nil? - Inspec::AttributeRegistry.find_attribute(name, profile_id).value + Inspec::InputRegistry.find_input(name, profile_id).value else - profile_context_owner.register_attribute(name, options) + profile_context_owner.register_input(name, options) end end diff --git a/lib/inspec/exceptions.rb b/lib/inspec/exceptions.rb index 6f1729ac6..d6ed253fc 100644 --- a/lib/inspec/exceptions.rb +++ b/lib/inspec/exceptions.rb @@ -3,8 +3,8 @@ module Inspec module Exceptions - class AttributesFileDoesNotExist < ArgumentError; end - class AttributesFileNotReadable < ArgumentError; end + class InputsFileDoesNotExist < ArgumentError; end + class InputsFileNotReadable < ArgumentError; end class ResourceFailed < StandardError; end class ResourceSkipped < StandardError; end class SecretsBackendNotFound < ArgumentError; end diff --git a/lib/inspec/objects.rb b/lib/inspec/objects.rb index 276876f90..cf3727f9b 100644 --- a/lib/inspec/objects.rb +++ b/lib/inspec/objects.rb @@ -1,7 +1,7 @@ # encoding: utf-8 module Inspec - autoload :Attribute, 'inspec/objects/input' + autoload :Input, 'inspec/objects/input' autoload :Tag, 'inspec/objects/tag' autoload :Control, 'inspec/objects/control' autoload :Describe, 'inspec/objects/describe' diff --git a/lib/inspec/profile.rb b/lib/inspec/profile.rb index 27109cf20..8a1fed957 100644 --- a/lib/inspec/profile.rb +++ b/lib/inspec/profile.rb @@ -135,7 +135,7 @@ module Inspec @runner_context.register_attribute(name, attr_dup) end elsif metadata.params.key?(:attributes) - Inspec::Log.warn 'Attributes must be defined as an Array. Skipping current definition.' + Inspec::Log.warn 'Inputs must be defined as an Array. Skipping current definition.' end end diff --git a/lib/inspec/profile_context.rb b/lib/inspec/profile_context.rb index 13a841095..c67a069cd 100644 --- a/lib/inspec/profile_context.rb +++ b/lib/inspec/profile_context.rb @@ -34,8 +34,8 @@ module Inspec @control_subcontexts = [] @lib_subcontexts = [] @require_loader = ::Inspec::RequireLoader.new - Inspec::AttributeRegistry.register_profile_alias(@profile_id, @profile_name) if @profile_id != @profile_name - @attributes = Inspec::AttributeRegistry.list_attributes_for_profile(@profile_id) + Inspec::InputRegistry.register_profile_alias(@profile_id, @profile_name) if @profile_id != @profile_name + @attributes = Inspec::InputRegistry.list_inputs_for_profile(@profile_id) # A local resource registry that only contains resources defined # in the transitive dependency tree of the loaded profile. @resource_registry = Inspec::Resource.new_registry @@ -188,8 +188,8 @@ module Inspec end def register_attribute(name, options = {}) - # we need to return an attribute object, to allow dermination of default values - attribute = Inspec::AttributeRegistry.register_attribute(name, @profile_id, options) + # we need to return an attribute object, to allow dermination of values + attribute = Inspec::InputRegistry.register_attribute(name, @profile_id, options) attribute.value = @conf['attributes'][name] unless @conf['attributes'].nil? || @conf['attributes'][name].nil? attribute.value end diff --git a/lib/inspec/rspec_extensions.rb b/lib/inspec/rspec_extensions.rb index ef25da72c..36beedcee 100644 --- a/lib/inspec/rspec_extensions.rb +++ b/lib/inspec/rspec_extensions.rb @@ -64,9 +64,9 @@ module Inspec end class RSpec::Core::ExampleGroup - # This DSL method allows us to access the values of attributes within InSpec tests + # This DSL method allows us to access the values of inputs within InSpec tests def attribute(name) - Inspec::AttributeRegistry.find_attribute(name, self.class.metadata[:profile_id]).value + Inspec::InputRegistry.find_input(name, self.class.metadata[:profile_id]).value end define_example_method :attribute diff --git a/lib/inspec/runner.rb b/lib/inspec/runner.rb index 8ea85718b..5f0c5f1bc 100644 --- a/lib/inspec/runner.rb +++ b/lib/inspec/runner.rb @@ -291,13 +291,13 @@ module Inspec def validate_attributes_file_readability!(target) unless File.exist?(target) - raise Inspec::Exceptions::AttributesFileDoesNotExist, + raise Inspec::Exceptions::InputsFileDoesNotExist, "Cannot find attributes file '#{target}'. " \ 'Check to make sure file exists.' end unless File.readable?(target) - raise Inspec::Exceptions::AttributesFileNotReadable, + raise Inspec::Exceptions::InputsFileNotReadable, "Cannot read attributes file '#{target}'. " \ 'Check to make sure file is readable.' end diff --git a/test/functional/inputs_test.rb b/test/functional/inputs_test.rb index 52d0ff948..0292d894b 100644 --- a/test/functional/inputs_test.rb +++ b/test/functional/inputs_test.rb @@ -38,7 +38,7 @@ describe 'attributes' do cmd += File.join(inputs_profiles_path, 'metadata-empty') cmd += ' --no-create-lockfile' out = inspec(cmd) - out.stdout.must_include 'WARN: Attributes must be defined as an Array. Skipping current definition.' + out.stdout.must_include 'WARN: Inputs must be defined as an Array. Skipping current definition.' out.exit_status.must_equal 0 end @@ -57,7 +57,7 @@ describe 'attributes' do cmd += File.join(inputs_profiles_path, 'required') cmd += ' --no-create-lockfile' out = inspec(cmd) - out.stderr.must_equal "Attribute 'username' is required and does not have a value.\n" + out.stderr.must_equal "Input 'username' is required and does not have a value.\n" out.stdout.must_equal '' out.exit_status.must_equal 1 end