diff --git a/app/controllers/lookups_controller.rb b/app/controllers/lookups_controller.rb index a5dd82e4..66dbacd5 100644 --- a/app/controllers/lookups_controller.rb +++ b/app/controllers/lookups_controller.rb @@ -5,6 +5,10 @@ class LookupsController < ApplicationController def show @result = @key.lookup(@node) + rescue Hdm::Error => error + @error = error + + render action: "error" end private diff --git a/app/views/lookups/error.html.erb b/app/views/lookups/error.html.erb new file mode 100644 index 00000000..9df4a8e7 --- /dev/null +++ b/app/views/lookups/error.html.erb @@ -0,0 +1,5 @@ +<%= turbo_frame_tag "lookup-result-frame" do %> +

+ <%= @error.message %> +

+<% end %> diff --git a/test/fixtures/files/puppet/environments/lookup_tests/data/common.yaml b/test/fixtures/files/puppet/environments/lookup_tests/data/common.yaml index 636779ce..5f46d2d2 100644 --- a/test/fixtures/files/puppet/environments/lookup_tests/data/common.yaml +++ b/test/fixtures/files/puppet/environments/lookup_tests/data/common.yaml @@ -18,6 +18,7 @@ hdm_nested_hash: nested_hash: integer: 32 added_by_common: common +hdm_mixed_types: 42 lookup_options: '^hdm_duplicates': merge: hash @@ -26,4 +27,6 @@ lookup_options: hash_syntax: merge: strategy: deep + hdm_mixed_types: + merge: deep diff --git a/test/fixtures/files/puppet/environments/lookup_tests/data/nodes/lookup.betadots.training.yaml b/test/fixtures/files/puppet/environments/lookup_tests/data/nodes/lookup.betadots.training.yaml index af1d6d20..fefa500d 100644 --- a/test/fixtures/files/puppet/environments/lookup_tests/data/nodes/lookup.betadots.training.yaml +++ b/test/fixtures/files/puppet/environments/lookup_tests/data/nodes/lookup.betadots.training.yaml @@ -14,3 +14,5 @@ hdm_nested_hash: origin: node nested_hash: integer: 5 +hdm_mixed_types: + from_node: 23