Add IPMI configurations and cleaned up nodes.conf

This commit is contained in:
Gregory Kurtzer
2020-11-22 21:03:18 -08:00
parent 5cd1dc901e
commit c8ed66a6dc
6 changed files with 150 additions and 36 deletions

View File

@@ -163,6 +163,65 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
}
}
if SetIpmiIpaddr != "" {
wwlog.Printf(wwlog.VERBOSE, "Group: %s, Setting IPMI IP address to: %s\n", g.Id, SetIpmiIpaddr)
err := nodeDB.SetGroupVal(g.Id, "ipmiipaddr", SetIpmiIpaddr)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
if SetClearNodes == true {
nodes, err := nodeDB.FindAllNodes()
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
for _, n := range nodes {
_ = nodeDB.SetNodeVal(g.Id, n.Id, "ipmiipaddr", "")
}
}
}
if SetIpmiUsername != "" {
wwlog.Printf(wwlog.VERBOSE, "Group: %s, Setting IPMI IP username to: %s\n", g.Id, SetIpmiUsername)
err := nodeDB.SetGroupVal(g.Id, "ipmiusername", SetIpmiUsername)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
if SetClearNodes == true {
nodes, err := nodeDB.FindAllNodes()
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
for _, n := range nodes {
_ = nodeDB.SetNodeVal(g.Id, n.Id, "ipmiusername", "")
}
}
}
if SetIpmiPassword != "" {
wwlog.Printf(wwlog.VERBOSE, "Group: %s, Setting IPMI IP password to: %s\n", g.Id, SetIpmiPassword)
err := nodeDB.SetGroupVal(g.Id, "ipmipassword", SetIpmiPassword)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
if SetClearNodes == true {
nodes, err := nodeDB.FindAllNodes()
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
}
for _, n := range nodes {
_ = nodeDB.SetNodeVal(g.Id, n.Id, "ipmipassword", "")
}
}
}
}