How to know if a network interface is up in a kickstart script?

I’m trying to setup bonding on some bare metal servers. Some of our servers have cables connected for eth1 but not eth2, but sometimes it’s the other way around. Is there a flag in Forman I can use to determine if one of these network interfaces are up? I suspect the “link” boolean carries this information, but I haven’t been able to find a doc that says what the variables mean.

This is a snippet from the kickstart script. It shows the interfaces list that prints out eth1 & eth2 (among other interfaces)
<% @host.interfaces.each do |interface| %>
<%= interface.identifier %>

This dumps out the data being fed into the kickstart script
<%= host_enc %>

Looking at that data dump, I noticed these contents about the network interface:
“virtual” => false,
"link" => true,
“identifier” => “eth2”,
“managed” => false,
“primary” => false,
“provision” => false,
“subnet” => nil,
“subnet6” => nil,
“tag” => nil,
“attached_to” => nil,
“type” => “Interface”
}, {
“ip” => nil,
“ip6” => nil,
“mac” => “e4:43:4b:3b:38:43”,
“name” => nil,
“attrs” => {
“mtu” => 1500, “duplex” => “unknown! (255)”, “port” => “Other”, “auto_negotiation” => “false”, “wol” => true

I noticed that “link” is true here. This is a network interface that works. On a couple that didn’t work, it was false. Is this the correct variable to tell me if the network interface has a physical cable attached? Or is there something else I should be doing?

If there are docs that explain what these different parameters/functions do in the kickstart script, I’d appreciate a link. I’ve been looking here:

Foreman version: 1.21.0
Smart proxy version: 1.24.2


Hello, sorry this slipped through my fingers.

Foreman core does not have a feature that would automatically detect which interface is online. However discovery does this if you do PXE - it carries over the information about which interface it was booted from (PXELinux does this via IPAPPEND2 command) and this carries over to the provisioning form.

However there are some limitations of discovery when it comes to network setup, it is worth trying.

1 Like