@host.model empty until installer runs

Hi,

I am trying to implement a different size of the swap partition if we’re just installing a virtual machine. Here the relevant contents of my partition table:

 <% swapsize = 2048 -%>
 \# debug comment host.model <%= @host.model.to_s %> <%= @host.model %> end
 <% if @host.model.to_s == 'VMware Virtual Platform' -%>
 \# Defaults for a 'VMware Virtual Platform' system applied
 <%   swapsize = 1024 -%>
 <% end -%><%# if @host.model.to_s == 'VMware Virtual Platform' -%>
 bootloader --location=mbr
 zerombr
 ignoredisk --only-use=<%= firstdisk %>
 clearpart --all --drives=<%= firstdisk %> --initlabel
 part pv.1 --size=1024 --grow --ondisk=<%= firstdisk %>
 volgroup system pv.1
 <% if swapsize.to_i > 0 -%>
 logvol swap --fstype=swap --name=swap --vgname=system --size=<%= swapsize %>
 <% end -%>

This works fine when I preview the template rendering in the Editor, but it doesn’t work for a newhost. The debug comment seems to end up as “debug comment host.model end” and the swapsize is set to 2048. This wrong behavior can be seen both in the installed system (original.ks) and when rendering the provisioning template template in the host in Foreman quickly after starting the deployment.

Once the installer is actually running, rendering the provisioning template in Foreman seems correct, but that doesn’t change the wrong kickstart file.

Am I doing things wrong, or is host.model unuseable in a partition table template?

Greetings
Marc, using Foreman 1.16.0 on CentOS 7.