Macro/Value existence testing in Provisioning templates (Foreman 1.2.1)

What I would like to do is to check if a host has a second network
interface (eth1 or BMC) from within a provisioning template and do some
extra stuff only if an second interface is found.

I tried to use @host.sp_ip and similar macro's in different ways but I keep
getting 500 errors even with save render off.

Also I' m not sure if I can use values for a second interface in a template
if it is not type BMC but interface.

I assume that @host.ip.1 and @host.ip.2 or something like this
(@host.ip.eth1 or @host.ip.interface1) will not exist.

Problem with @host.sp_ip is that if an host has no BMC interface I will get
an Nil error.

The solution must be able to handle the absence of macro's I test against.

@Dominic solved my problem.

Testing for second interface (either type interface or bmc) can be done

<% if @host.interfaces.size > 0 -%> # Host has first interface but is not
shown by host.interfaces. Thats why > 0 instead of > 1.

Do something

<% end -%>


<% if !@host.interfaces.empty? -%>

Do something

<% end -%>

For this to work: "save render" should be set to false in (provisioning) settings.