For just one netdev make it the default

This commit is contained in:
Christian Goll
2022-02-17 10:35:03 +01:00
parent f1ac7cc620
commit 704248f2da

View File

@@ -95,7 +95,6 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
var netdev NetDevEntry
n.NetDevs[devname] = &netdev
}
n.NetDevs[devname].Device.Set(netdev.Device)
n.NetDevs[devname].Ipaddr.Set(netdev.Ipaddr)
n.NetDevs[devname].Netmask.Set(netdev.Netmask)
@@ -104,6 +103,10 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
n.NetDevs[devname].Type.Set(netdev.Type)
n.NetDevs[devname].OnBoot.Set(netdev.OnBoot)
n.NetDevs[devname].Default.Set(netdev.Default)
// for just one netdeve, it is always the default
if len(node.NetDevs) == 1 {
n.NetDevs[devname].Default.Set("true")
}
}
// Merge Keys into Tags for backwards compatibility