Various fixes found in testing
This commit is contained in:
@@ -168,10 +168,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
if SetNetName != "" {
|
||||
if _, ok := n.NetDevs[SetNetName]; !ok {
|
||||
var nd node.NetDevEntry
|
||||
n.NetDevs[SetNetName] = &nd
|
||||
|
||||
SetNetOnBoot = "yes"
|
||||
|
||||
if len(n.NetDevs) == 0 {
|
||||
SetNetDefault = "yes"
|
||||
}
|
||||
|
||||
n.NetDevs[SetNetName] = &nd
|
||||
|
||||
if SetNetDev == "" {
|
||||
n.NetDevs[SetNetName].Device.Set(SetNetName)
|
||||
}
|
||||
@@ -255,6 +260,27 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
if SetNetDefault != "" {
|
||||
if SetNetName == "" {
|
||||
wwlog.Printf(wwlog.ERROR, "You must include the '--netname' option\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if SetNetDefault == "yes" || SetNetDefault == "y" || SetNetDefault == "1" || SetNetDefault == "true" {
|
||||
|
||||
// Set all other devices to non-default
|
||||
for _, n := range n.NetDevs {
|
||||
n.Default.SetB(false)
|
||||
}
|
||||
|
||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting DEFAULT\n", n.Id.Get(), SetNetName)
|
||||
n.NetDevs[SetNetName].Default.SetB(true)
|
||||
} else {
|
||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Unsetting DEFAULT\n", n.Id.Get(), SetNetName)
|
||||
n.NetDevs[SetNetName].Default.SetB(false)
|
||||
}
|
||||
}
|
||||
|
||||
if SetNetDevDel {
|
||||
if SetNetName == "" {
|
||||
wwlog.Printf(wwlog.ERROR, "You must include the '--netname' option\n")
|
||||
|
||||
Reference in New Issue
Block a user