From c0b213c46af64e3fb92ea70acc3d380924cf056f Mon Sep 17 00:00:00 2001 From: Nikita Mathur Date: Wed, 31 Mar 2021 11:42:51 +0530 Subject: [PATCH 1/5] Bug fix for loading hashmap inputs consistently from external and metadata file Signed-off-by: Nikita Mathur --- lib/inspec/input_registry.rb | 3 +- .../inputs/hashmap/controls/hashmap_input.rb | 32 +++++++++++++++++++ .../inputs/hashmap/external_attributes.yml | 4 +++ .../profiles/inputs/hashmap/inspec.yml | 17 ++++++++++ test/functional/inputs_test.rb | 9 ++++++ 5 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb create mode 100644 test/fixtures/profiles/inputs/hashmap/external_attributes.yml create mode 100644 test/fixtures/profiles/inputs/hashmap/inspec.yml diff --git a/lib/inspec/input_registry.rb b/lib/inspec/input_registry.rb index f6fad5d85..8e327de4a 100644 --- a/lib/inspec/input_registry.rb +++ b/lib/inspec/input_registry.rb @@ -256,7 +256,7 @@ module Inspec data.inputs.each do |input_name, input_value| evt = Inspec::Input::Event.new( - value: input_value, + value: input_value&.class.eql?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value, provider: :cli_files, priority: 40, file: path @@ -307,6 +307,7 @@ module Inspec def handle_raw_input_from_metadata(input_orig, profile_name) input_options = input_orig.dup input_name = input_options.delete(:name) + input_options[:value] = Thor::CoreExt::HashWithIndifferentAccess.new(input_options[:value]) if input_options[:value]&.class.eql?(Hash) input_options[:provider] = :profile_metadata input_options[:file] = File.join(profile_name, "inspec.yml") input_options[:priority] ||= 30 diff --git a/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb b/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb new file mode 100644 index 000000000..0c6b5c14b --- /dev/null +++ b/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb @@ -0,0 +1,32 @@ +# copyright: 218, The Authors +title "Verifying loading of hashmap inputs using metadata and external file" + +# controls to test metadata file hash traversing + +control "hashmap-metadata" do + title "Verifying loading of hashmap inputs using metadata file" + + describe input('metadata_basic_key') do + it { should cmp 'metadata_basic_value' } + end + + describe input('metadata_nested_key') do + its(['metadata_nested_key_str']) { should eq 'metadata_nested_value_str' } + its([:metadata_nested_key_sym]) { should eq 'metadata_nested_value_sym' } + end +end + +# controls to test external attribute file hash traversing + +control "hashmap-external-file" do + title "Verifying loading of hashmap inputs using external file" + + describe input('external_attribute_basic_key') do + it { should cmp 'external_attribute_basic_value' } + end + + describe input('external_attribute_nested_key') do + its(['external_attribute_nested_key_str']) { should eq 'external_attribute_nested_value_str' } + its([:external_attribute_nested_key_sym]) { should eq 'external_attribute_nested_value_sym' } + end +end \ No newline at end of file diff --git a/test/fixtures/profiles/inputs/hashmap/external_attributes.yml b/test/fixtures/profiles/inputs/hashmap/external_attributes.yml new file mode 100644 index 000000000..d019dbcb9 --- /dev/null +++ b/test/fixtures/profiles/inputs/hashmap/external_attributes.yml @@ -0,0 +1,4 @@ +external_attribute_basic_key: external_attribute_basic_value +external_attribute_nested_key: + external_attribute_nested_key_str: external_attribute_nested_value_str + external_attribute_nested_key_sym: external_attribute_nested_value_sym \ No newline at end of file diff --git a/test/fixtures/profiles/inputs/hashmap/inspec.yml b/test/fixtures/profiles/inputs/hashmap/inspec.yml new file mode 100644 index 000000000..51bcbc171 --- /dev/null +++ b/test/fixtures/profiles/inputs/hashmap/inspec.yml @@ -0,0 +1,17 @@ +name: hashmap +title: InSpec Profile +maintainer: The Authors +copyright: The Authors +copyright_email: you@example.com +license: Apache-2.0 +summary: A profile that checks the hash inputs using metadata file and external file. +version: 0.1.0 +supports: + platform: os +inputs: +- name: metadata_basic_key + value: metadata_basic_value +- name: metadata_nested_key + value: + metadata_nested_key_str: metadata_nested_value_str + metadata_nested_key_sym: metadata_nested_value_sym \ No newline at end of file diff --git a/test/functional/inputs_test.rb b/test/functional/inputs_test.rb index c14c722a6..937b3f89d 100644 --- a/test/functional/inputs_test.rb +++ b/test/functional/inputs_test.rb @@ -6,6 +6,7 @@ require "tempfile" describe "inputs" do include FunctionalHelper let(:inputs_profiles_path) { File.join(profile_path, "inputs") } + let(:external_attributes_file_path) { "#{inputs_profiles_path}/hashmap/external_attributes.yml" } parallelize_me! @@ -442,4 +443,12 @@ describe "inputs" do _(inputs[2]["options"]["value"]).wont_include "***" # Explicit sensitive = false end end + + describe "when a profile is executed with external inputs and inputs defined in metadata file" do + it "should access the values successfully from in both input ways" do + result = run_inspec_process("exec #{inputs_profiles_path}/hashmap --input-file #{external_attributes_file_path}", json: true) + _(result.stderr).must_be_empty + assert_json_controls_passing(result) + end + end end From a55b083b0afe753c189c33896351016013a1ca54 Mon Sep 17 00:00:00 2001 From: Nikita Mathur Date: Wed, 31 Mar 2021 12:35:11 +0530 Subject: [PATCH 2/5] Improvements in various descriptions and a better way to check for hash type Signed-off-by: Nikita Mathur --- lib/inspec/input_registry.rb | 4 ++-- .../profiles/inputs/hashmap/controls/hashmap_input.rb | 4 ---- test/fixtures/profiles/inputs/hashmap/inspec.yml | 2 +- test/functional/inputs_test.rb | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/inspec/input_registry.rb b/lib/inspec/input_registry.rb index 8e327de4a..2d39dfe27 100644 --- a/lib/inspec/input_registry.rb +++ b/lib/inspec/input_registry.rb @@ -256,7 +256,7 @@ module Inspec data.inputs.each do |input_name, input_value| evt = Inspec::Input::Event.new( - value: input_value&.class.eql?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value, + value: input_value.is_a?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value, provider: :cli_files, priority: 40, file: path @@ -307,7 +307,7 @@ module Inspec def handle_raw_input_from_metadata(input_orig, profile_name) input_options = input_orig.dup input_name = input_options.delete(:name) - input_options[:value] = Thor::CoreExt::HashWithIndifferentAccess.new(input_options[:value]) if input_options[:value]&.class.eql?(Hash) + input_options[:value] = Thor::CoreExt::HashWithIndifferentAccess.new(input_options[:value]) if input_options[:value].is_a?(Hash) input_options[:provider] = :profile_metadata input_options[:file] = File.join(profile_name, "inspec.yml") input_options[:priority] ||= 30 diff --git a/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb b/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb index 0c6b5c14b..c88f76bef 100644 --- a/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb +++ b/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb @@ -1,8 +1,6 @@ # copyright: 218, The Authors title "Verifying loading of hashmap inputs using metadata and external file" -# controls to test metadata file hash traversing - control "hashmap-metadata" do title "Verifying loading of hashmap inputs using metadata file" @@ -16,8 +14,6 @@ control "hashmap-metadata" do end end -# controls to test external attribute file hash traversing - control "hashmap-external-file" do title "Verifying loading of hashmap inputs using external file" diff --git a/test/fixtures/profiles/inputs/hashmap/inspec.yml b/test/fixtures/profiles/inputs/hashmap/inspec.yml index 51bcbc171..cd86c511d 100644 --- a/test/fixtures/profiles/inputs/hashmap/inspec.yml +++ b/test/fixtures/profiles/inputs/hashmap/inspec.yml @@ -4,7 +4,7 @@ maintainer: The Authors copyright: The Authors copyright_email: you@example.com license: Apache-2.0 -summary: A profile that checks the hash inputs using metadata file and external file. +summary: A profile that checks loading of hashmap inputs using metadata file and external file. version: 0.1.0 supports: platform: os diff --git a/test/functional/inputs_test.rb b/test/functional/inputs_test.rb index 937b3f89d..1741b394d 100644 --- a/test/functional/inputs_test.rb +++ b/test/functional/inputs_test.rb @@ -445,7 +445,7 @@ describe "inputs" do end describe "when a profile is executed with external inputs and inputs defined in metadata file" do - it "should access the values successfully from in both input ways" do + it "should access the values successfully from both input ways" do result = run_inspec_process("exec #{inputs_profiles_path}/hashmap --input-file #{external_attributes_file_path}", json: true) _(result.stderr).must_be_empty assert_json_controls_passing(result) From ec30fc3d4e23ef5e17e6834190b4eaa2b8609d00 Mon Sep 17 00:00:00 2001 From: Nikita Mathur Date: Mon, 5 Apr 2021 14:41:26 +0530 Subject: [PATCH 3/5] Hash with indifference changes for inputs used via runner api Signed-off-by: Nikita Mathur --- lib/inspec/input_registry.rb | 2 +- .../inputs/via-runner/controls/via-runner.rb | 8 ++++++++ test/functional/inputs_test.rb | 13 ++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/inspec/input_registry.rb b/lib/inspec/input_registry.rb index 2d39dfe27..bd4b49a4f 100644 --- a/lib/inspec/input_registry.rb +++ b/lib/inspec/input_registry.rb @@ -225,7 +225,7 @@ module Inspec input_hash.each do |input_name, input_value| loc = Inspec::Input::Event.probe_stack # TODO: likely modify this to look for a kitchen.yml, if that is realistic evt = Inspec::Input::Event.new( - value: input_value, + value: input_value.is_a?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value, provider: :runner_api, # TODO: suss out if audit cookbook or kitchen-inspec or something unknown priority: 40, file: loc.path, diff --git a/test/fixtures/profiles/inputs/via-runner/controls/via-runner.rb b/test/fixtures/profiles/inputs/via-runner/controls/via-runner.rb index 49f3b7f56..bdc751e63 100644 --- a/test/fixtures/profiles/inputs/via-runner/controls/via-runner.rb +++ b/test/fixtures/profiles/inputs/via-runner/controls/via-runner.rb @@ -2,4 +2,12 @@ control "test_control_01" do describe input("test_input_01", value: "value_from_dsl") do it { should cmp "value_from_api" } end + + describe input("test_input_hash_string", value: { "string_key": "string_value_dsl" }) do + its(['string_key']) { should eq 'string_value' } + end + + describe input("test_input_hash_symbol", value: { symbol_key: :symbol_value_dsl }) do + its([:symbol_key]) { should eq :symbol_value } + end end diff --git a/test/functional/inputs_test.rb b/test/functional/inputs_test.rb index 1741b394d..c49343363 100644 --- a/test/functional/inputs_test.rb +++ b/test/functional/inputs_test.rb @@ -124,7 +124,6 @@ describe "inputs" do describe "when using the current :inputs key" do let(:runner_options) { common_options.merge({ inputs: { test_input_01: "value_from_api" } }) } - it "finds the values and does not issue any warnings" do output = run_result.stdout refute_includes output, "DEPRECATION" @@ -133,6 +132,18 @@ describe "inputs" do end end + describe "when using the current :inputs key with both string and symbol key in hashes" do + let(:runner_options) { common_options.merge({ inputs: { test_input_01: "value_from_api", test_input_hash_string: { "string_key": "string_value" }, test_input_hash_symbol: { symbol_key: :symbol_value } } }) } + + it "finds the values and runs successfully" do + output = run_result.stdout + structured_output = JSON.parse(output) + assert_equal "passed", structured_output["profiles"][0]["controls"][0]["results"][0]["status"] + assert_equal "passed", structured_output["profiles"][0]["controls"][0]["results"][1]["status"] + assert_equal "passed", structured_output["profiles"][0]["controls"][0]["results"][2]["status"] + end + end + describe "when using the legacy :attributes key" do let(:runner_options) { common_options.merge({ attributes: { test_input_01: "value_from_api" } }) } it "finds the values but issues a DEPRECATION warning" do From 094293b01dfc91657c6ef473f34b352d9536bdf8 Mon Sep 17 00:00:00 2001 From: Nikita Mathur Date: Mon, 5 Apr 2021 16:10:47 +0530 Subject: [PATCH 4/5] Refactored logic to enable hash indifference in all input types Signed-off-by: Nikita Mathur --- lib/inspec/input_registry.rb | 6 ++-- .../inputs/hashmap/controls/hashmap_input.rb | 36 +++++++++++++------ .../inputs/via-runner/controls/via-runner.rb | 2 +- test/functional/inputs_test.rb | 4 +-- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/lib/inspec/input_registry.rb b/lib/inspec/input_registry.rb index bd4b49a4f..1b2ea9667 100644 --- a/lib/inspec/input_registry.rb +++ b/lib/inspec/input_registry.rb @@ -82,6 +82,7 @@ module Inspec def find_or_register_input(input_name, profile_name, options = {}) input_name = input_name.to_s profile_name = profile_name.to_s + options[:event].value = Thor::CoreExt::HashWithIndifferentAccess.new(options[:event].value) if options[:event]&.value.is_a?(Hash) if profile_alias?(profile_name) && !profile_aliases[profile_name].nil? alias_name = profile_name @@ -225,7 +226,7 @@ module Inspec input_hash.each do |input_name, input_value| loc = Inspec::Input::Event.probe_stack # TODO: likely modify this to look for a kitchen.yml, if that is realistic evt = Inspec::Input::Event.new( - value: input_value.is_a?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value, + value: input_value, provider: :runner_api, # TODO: suss out if audit cookbook or kitchen-inspec or something unknown priority: 40, file: loc.path, @@ -256,7 +257,7 @@ module Inspec data.inputs.each do |input_name, input_value| evt = Inspec::Input::Event.new( - value: input_value.is_a?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value, + value: input_value, provider: :cli_files, priority: 40, file: path @@ -307,7 +308,6 @@ module Inspec def handle_raw_input_from_metadata(input_orig, profile_name) input_options = input_orig.dup input_name = input_options.delete(:name) - input_options[:value] = Thor::CoreExt::HashWithIndifferentAccess.new(input_options[:value]) if input_options[:value].is_a?(Hash) input_options[:provider] = :profile_metadata input_options[:file] = File.join(profile_name, "inspec.yml") input_options[:priority] ||= 30 diff --git a/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb b/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb index c88f76bef..3f3425f62 100644 --- a/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb +++ b/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb @@ -4,25 +4,41 @@ title "Verifying loading of hashmap inputs using metadata and external file" control "hashmap-metadata" do title "Verifying loading of hashmap inputs using metadata file" - describe input('metadata_basic_key') do - it { should cmp 'metadata_basic_value' } + describe input("metadata_basic_key") do + it { should cmp "metadata_basic_value" } end - describe input('metadata_nested_key') do - its(['metadata_nested_key_str']) { should eq 'metadata_nested_value_str' } - its([:metadata_nested_key_sym]) { should eq 'metadata_nested_value_sym' } + describe input("metadata_nested_key") do + its(["metadata_nested_key_str"]) { should eq "metadata_nested_value_str" } + its([:metadata_nested_key_sym]) { should eq "metadata_nested_value_sym" } end end control "hashmap-external-file" do title "Verifying loading of hashmap inputs using external file" - describe input('external_attribute_basic_key') do - it { should cmp 'external_attribute_basic_value' } + describe input("external_attribute_basic_key") do + it { should cmp "external_attribute_basic_value" } end - describe input('external_attribute_nested_key') do - its(['external_attribute_nested_key_str']) { should eq 'external_attribute_nested_value_str' } - its([:external_attribute_nested_key_sym]) { should eq 'external_attribute_nested_value_sym' } + describe input("external_attribute_nested_key") do + its(["external_attribute_nested_key_str"]) { should eq "external_attribute_nested_value_str" } + its([:external_attribute_nested_key_sym]) { should eq "external_attribute_nested_value_sym" } + end +end + +control "hashmap-profile-DSL" do + title "Verifying loading of hashmap inputs using profile DSL" + + describe input("dsl_basic_key", value: "dsl_basic_value") do + it { should cmp "dsl_basic_value" } + end + + describe input("dsl_hash_string", value: { "dsl_nested_key_str": "dsl_nested_value_str" } ) do + its(["dsl_nested_key_str"]) { should eq "dsl_nested_value_str" } + end + + describe input("dsl_hash_symbol", value: { dsl_nested_key_sym: :dsl_nested_value_sym } ) do + its([:dsl_nested_key_sym]) { should eq :dsl_nested_value_sym } end end \ No newline at end of file diff --git a/test/fixtures/profiles/inputs/via-runner/controls/via-runner.rb b/test/fixtures/profiles/inputs/via-runner/controls/via-runner.rb index bdc751e63..5935155a9 100644 --- a/test/fixtures/profiles/inputs/via-runner/controls/via-runner.rb +++ b/test/fixtures/profiles/inputs/via-runner/controls/via-runner.rb @@ -4,7 +4,7 @@ control "test_control_01" do end describe input("test_input_hash_string", value: { "string_key": "string_value_dsl" }) do - its(['string_key']) { should eq 'string_value' } + its(["string_key"]) { should eq "string_value" } end describe input("test_input_hash_symbol", value: { symbol_key: :symbol_value_dsl }) do diff --git a/test/functional/inputs_test.rb b/test/functional/inputs_test.rb index c49343363..b4c7f85e2 100644 --- a/test/functional/inputs_test.rb +++ b/test/functional/inputs_test.rb @@ -455,8 +455,8 @@ describe "inputs" do end end - describe "when a profile is executed with external inputs and inputs defined in metadata file" do - it "should access the values successfully from both input ways" do + describe "when a profile is executed with inputs through external file, metadata file and profile DSL" do + it "should access the values successfully from all input ways" do result = run_inspec_process("exec #{inputs_profiles_path}/hashmap --input-file #{external_attributes_file_path}", json: true) _(result.stderr).must_be_empty assert_json_controls_passing(result) From 82e126726b6732aeac91408035ad141d1d6c7bff Mon Sep 17 00:00:00 2001 From: Nikita Mathur Date: Wed, 7 Apr 2021 16:09:25 +0530 Subject: [PATCH 5/5] Improvements in hashmap profiles Signed-off-by: Nikita Mathur --- .../inputs/hashmap/controls/hashmap_input.rb | 34 ++++++------------- .../inputs/hashmap/external_attributes.yml | 4 --- .../profiles/inputs/hashmap/files/inputs.yml | 3 ++ .../profiles/inputs/hashmap/inspec.yml | 17 ++++------ test/functional/inputs_test.rb | 2 +- 5 files changed, 22 insertions(+), 38 deletions(-) delete mode 100644 test/fixtures/profiles/inputs/hashmap/external_attributes.yml create mode 100644 test/fixtures/profiles/inputs/hashmap/files/inputs.yml diff --git a/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb b/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb index 3f3425f62..f26c3d25f 100644 --- a/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb +++ b/test/fixtures/profiles/inputs/hashmap/controls/hashmap_input.rb @@ -1,44 +1,32 @@ -# copyright: 218, The Authors +# copyright: 2021, Chef Software, Inc. title "Verifying loading of hashmap inputs using metadata and external file" control "hashmap-metadata" do title "Verifying loading of hashmap inputs using metadata file" - describe input("metadata_basic_key") do - it { should cmp "metadata_basic_value" } - end - - describe input("metadata_nested_key") do - its(["metadata_nested_key_str"]) { should eq "metadata_nested_value_str" } - its([:metadata_nested_key_sym]) { should eq "metadata_nested_value_sym" } + describe input("metadata_hash") do + its(["metadata_hash_key_str"]) { should eq "metadata_hash_value_str" } + its([:metadata_hash_key_sym]) { should eq "metadata_hash_value_sym" } end end control "hashmap-external-file" do title "Verifying loading of hashmap inputs using external file" - describe input("external_attribute_basic_key") do - it { should cmp "external_attribute_basic_value" } - end - - describe input("external_attribute_nested_key") do - its(["external_attribute_nested_key_str"]) { should eq "external_attribute_nested_value_str" } - its([:external_attribute_nested_key_sym]) { should eq "external_attribute_nested_value_sym" } + describe input("external_input_hash") do + its(["external_input_hash_key_str"]) { should eq "external_input_hash_value_str" } + its([:external_input_hash_key_sym]) { should eq "external_input_hash_value_sym" } end end control "hashmap-profile-DSL" do title "Verifying loading of hashmap inputs using profile DSL" - describe input("dsl_basic_key", value: "dsl_basic_value") do - it { should cmp "dsl_basic_value" } + describe input("dsl_hash_string", value: { "dsl_hash_string_key": "dsl_hash_string_value" } ) do + its(["dsl_hash_string_key"]) { should eq "dsl_hash_string_value" } end - describe input("dsl_hash_string", value: { "dsl_nested_key_str": "dsl_nested_value_str" } ) do - its(["dsl_nested_key_str"]) { should eq "dsl_nested_value_str" } - end - - describe input("dsl_hash_symbol", value: { dsl_nested_key_sym: :dsl_nested_value_sym } ) do - its([:dsl_nested_key_sym]) { should eq :dsl_nested_value_sym } + describe input("dsl_hash_symbol", value: { dsl_hash_symbol_key: :dsl_hash_symbol_value } ) do + its([:dsl_hash_symbol_key]) { should eq :dsl_hash_symbol_value } end end \ No newline at end of file diff --git a/test/fixtures/profiles/inputs/hashmap/external_attributes.yml b/test/fixtures/profiles/inputs/hashmap/external_attributes.yml deleted file mode 100644 index d019dbcb9..000000000 --- a/test/fixtures/profiles/inputs/hashmap/external_attributes.yml +++ /dev/null @@ -1,4 +0,0 @@ -external_attribute_basic_key: external_attribute_basic_value -external_attribute_nested_key: - external_attribute_nested_key_str: external_attribute_nested_value_str - external_attribute_nested_key_sym: external_attribute_nested_value_sym \ No newline at end of file diff --git a/test/fixtures/profiles/inputs/hashmap/files/inputs.yml b/test/fixtures/profiles/inputs/hashmap/files/inputs.yml new file mode 100644 index 000000000..779447013 --- /dev/null +++ b/test/fixtures/profiles/inputs/hashmap/files/inputs.yml @@ -0,0 +1,3 @@ +external_input_hash: + external_input_hash_key_str: external_input_hash_value_str + external_input_hash_key_sym: external_input_hash_value_sym \ No newline at end of file diff --git a/test/fixtures/profiles/inputs/hashmap/inspec.yml b/test/fixtures/profiles/inputs/hashmap/inspec.yml index cd86c511d..07bce703c 100644 --- a/test/fixtures/profiles/inputs/hashmap/inspec.yml +++ b/test/fixtures/profiles/inputs/hashmap/inspec.yml @@ -1,17 +1,14 @@ name: hashmap -title: InSpec Profile -maintainer: The Authors -copyright: The Authors -copyright_email: you@example.com +title: InSpec Profile to verify hashmap inputs +maintainer: Chef Software, Inc. +copyright: Chef Software, Inc. license: Apache-2.0 -summary: A profile that checks loading of hashmap inputs using metadata file and external file. +summary: A profile that checks loading of hashmap inputs version: 0.1.0 supports: platform: os inputs: -- name: metadata_basic_key - value: metadata_basic_value -- name: metadata_nested_key +- name: metadata_hash value: - metadata_nested_key_str: metadata_nested_value_str - metadata_nested_key_sym: metadata_nested_value_sym \ No newline at end of file + metadata_hash_key_str: metadata_hash_value_str + metadata_hash_key_sym: metadata_hash_value_sym \ No newline at end of file diff --git a/test/functional/inputs_test.rb b/test/functional/inputs_test.rb index b4c7f85e2..499651081 100644 --- a/test/functional/inputs_test.rb +++ b/test/functional/inputs_test.rb @@ -6,7 +6,7 @@ require "tempfile" describe "inputs" do include FunctionalHelper let(:inputs_profiles_path) { File.join(profile_path, "inputs") } - let(:external_attributes_file_path) { "#{inputs_profiles_path}/hashmap/external_attributes.yml" } + let(:external_attributes_file_path) { "#{inputs_profiles_path}/hashmap/files/inputs.yml" } parallelize_me!