diff --git a/internal/app/wwctl/node/set/main.go b/internal/app/wwctl/node/set/main.go index 2522c087..1c0312e6 100644 --- a/internal/app/wwctl/node/set/main.go +++ b/internal/app/wwctl/node/set/main.go @@ -174,14 +174,26 @@ func CobraRunE(cmd *cobra.Command, args []string) error { if _, ok := n.NetDevs[SetNetName]; !ok { var nd node.NetDevEntry - SetNetOnBoot = "yes" - - if len(n.NetDevs) == 0 { - SetNetDefault = "yes" - } - n.NetDevs[SetNetName] = &nd + + if SetNetDev == "" { + n.NetDevs[SetNetName].Device.Set(SetNetName) + } } + var def bool = true + + SetNetOnBoot = "yes" + + for _, n := range n.NetDevs { + if n.Default.GetB() { + def = false + } + } + + if def { + SetNetDefault = "yes" + } + } if SetNetDev != "" {