Problem:
Add puppet class with a Hash parameter to a Host
Enable “Merge Overrides” on the parameter
Use template macros (i.e. <%= foreman_server_fqdn %>) in hiera value of that parameter
puppet agent will start failing with error:
Error 500 on SERVER: Server Error: Failed to find node01.example.com via exec: Execution of '/etc/puppetlabs/puppet/node.rb node01.example.com' returned 1:
Can be tested with hash_resources class and setting the value of resources parameter to:
file:
"/tmp/testfile":
ensure: present
content: <%= foreman_server_fqdn %>
Expected outcome:
Hiera should work the way it works for “Merge Overrides” disabled
Foreman and Proxy versions:
Foreman 1.20.1
Puppet 3.6.2
Other relevant data:
The foreman production generates the following error
2018-12-22T09:35:18 [W|app|8688b] Failed to generate external nodes for node01.example.com
TypeError: no implicit conversion of String into Hash
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/core_ext/hash/deep_merge.rb:24:in `merge!'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/core_ext/hash/deep_merge.rb:24:in `deep_merge!'
/usr/share/foreman/app/services/classification/values_hash_query.rb:160:in `block in update_hash_matcher'
/usr/share/foreman/app/services/classification/values_hash_query.rb:155:in `reverse_each'
/usr/share/foreman/app/services/classification/values_hash_query.rb:155:in `update_hash_matcher'
/usr/share/foreman/app/services/classification/values_hash_query.rb:52:in `merged_value'
/usr/share/foreman/app/services/classification/values_hash_query.rb:38:in `calculate_value'
/usr/share/foreman/app/services/classification/values_hash_query.rb:21:in `block in values_hash'
...