Problem:
When I use variables (for example <%= @host.params[‘http_proxy_user’] %>) in puppet smart parameters and want to merge this parameter it can’t generate the puppet YAML ENC.
I submitted it a few months ago as a bug Bug #19980: Error in ENC YAML generation when merge enabled and variable or macro is present in parameters - Foreman but as there is not really any response I am wondering if it’s me that is doing something wrong.
Expected outcome:
Usage of variables in merged smart parameters
Foreman and Proxy versions:
1.16, 1.16
Foreman and Proxy plugin versions:
Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
I’m guessing that the classification sees the generated output as a string so it fails to merge it since it expects an array or hash. Perhaps @Ori_Rabin has some idea about this?
@FrediWeber could you provide screenshots or the exact values you are trying to merge?
The erb is only evaluated when creating the ENC output and from the error is looks like it’s evaluating to a string and not array or hash.
If this needs to be an array it should probably look like: <%= [@host.params[‘http_proxy_user’]] %>
but I need to see the actual values to know more.
Yes, for example we try to set the right values for apt sources:
debian_stable:
comment: Debian Stable Source
location: "http://<%= @host.params[‘apt_proxy’] %>debian.ethz.ch/debian"
architecture: amd64
include:
src: true
The parameters “apt_proxy” value is "http-apt-proxy.local"
I guess Foreman doesn’t know that the value is a string and tries to merge it where it fails…
I investigated the bug a little bit deeper and think that it was introduced by the fix #8052.
The value is not stored as a hash or array but as a string. Therefore it can’t parse it correctly on the output.