Fixed default network device logic

This commit is contained in:
Gregory Kurtzer
2022-02-12 03:21:31 +00:00
parent e6a3810d20
commit 1a48bc6ee5

View File

@@ -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 != "" {