Hi,
I'm having a strange problem with my foreman 1.13 setup.
I have a central foreman server and a smart proxy in a different subnet.
I'm trying to build hosts in that subnet.
I've configured the smart proxy to enable template support.
The issue I'm having is that one of my host params is being completely
ignored.
In my partition template, I have the following:
os_soft_raid = @host.params['os_soft_raid'] || true
I'm then using this variable later, let's say like this:
if [ "<%= os_soft_raid -%>" == "true" ]; then
do some software raid things
fi
I have explicitly set the host param to "false" and if I preview the
template via the foreman UI for the host I'm trying to build, it correctly
shows that os_soft_raid gets rendered into "false". However, when the host
contacts the smart proxy to get the template, the os_soft_raid param is set
to "true", the default.
I can replicate this by either going to my central foreman instance with
the following uri:
http://foreman.my.domain/unattended/provision?token=111178ea-08ca-4db4-946c-11faf4bcd681&url=http%3A%2F%2F10.1.1.1%3A8000
Or by visiting the smart proxy on port 8000 with the below uri:
http://10.1.1.1:8000//unattended/provision?token=
111178ea-08ca-4db4-946c-11faf4bcd681
I don't have this param declared on the subnet - I just thought to check
this as I was typing.
This behaviour is the same whether I set the os_soft_raid param against the
host_group or the individual host.
Can anyone help me to work out why this host param is being ignored in this
way?
Thanks
J
Thanks Dominic.
I've applied the changes in your commit to the unattended_controller.rb as
per your PR and am happy to report that my params are not being resolved
correctly.
Many thanks for your help.
This is tracked under Bug #17395: @host.params are not interpreted when was used in ptable kickstart template. - Foreman, with
a fix under review that will likely be in 1.13.3.
It happens under some OS types when the partition table also contains
references to params - if you're able to remove that, it'd probably work
around the issue.
···
On 07/12/16 14:47, jamese wrote:
> The issue I'm having is that one of my host params is being completely
> ignored.
>
> In my partition template, I have the following:
>
> os_soft_raid = @host.params['os_soft_raid'] || true
>
> I'm then using this variable later, let's say like this:
> if [ "<%= os_soft_raid -%>" == "true" ]; then
> do some software raid things
> fi
>
> I have explicitly set the host param to "false" and if I preview the
> template via the foreman UI for the host I'm trying to build, it
> correctly shows that os_soft_raid gets rendered into "false". However,
> when the host contacts the smart proxy to get the template, the
> os_soft_raid param is set to "true", the default.
>
> I can replicate this by either going to my central foreman instance with
> the following uri:
>
> http://foreman.my.domain/unattended/provision?token=111178ea-08ca-4db4-946c-11faf4bcd681&url=http%3A%2F%2F10.1.1.1%3A8000
–
Dominic Cleal
dominic@cleal.org