try to use same network name for all nodes
This commit is contained in:
@@ -38,20 +38,29 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
cmd.Usage()
|
cmd.Usage()
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
globalPrimary := ""
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
var primaryNet string
|
var primaryNet string
|
||||||
|
if _, ok := node.NetDevs[globalPrimary]; ok {
|
||||||
|
if node.NetDevs[globalPrimary].Primary.GetB() {
|
||||||
|
primaryNet = globalPrimary
|
||||||
|
}
|
||||||
|
}
|
||||||
for netName := range node.NetDevs {
|
for netName := range node.NetDevs {
|
||||||
if node.NetDevs[netName].Primary.GetB() {
|
if node.NetDevs[netName].Primary.GetB() {
|
||||||
primaryNet = netName
|
primaryNet = netName
|
||||||
|
if globalPrimary == "" {
|
||||||
|
globalPrimary = netName
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if primaryNet == "" {
|
if primaryNet == "" {
|
||||||
fmt.Fprintf(os.Stderr, "%s: Primary network device doesn't exist\n", node.Id.Get())
|
wwlog.Error("%s: Primary network device doesn't exist\n", node.Id.Get())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if node.NetDevs[primaryNet].Ipaddr.Get() == "" {
|
if node.NetDevs[primaryNet].Ipaddr.Get() == "" {
|
||||||
fmt.Fprintf(os.Stderr, "%s: Primary network IP address not configured\n", node.Id.Get())
|
wwlog.Error("%s: Primary network IP address not configured\n", node.Id.Get())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user