diff --git a/internal/app/wwctl/node/set/main.go b/internal/app/wwctl/node/set/main.go index 4fd0bd37..75b07aaa 100644 --- a/internal/app/wwctl/node/set/main.go +++ b/internal/app/wwctl/node/set/main.go @@ -17,6 +17,7 @@ import ( func CobraRunE(cmd *cobra.Command, args []string) error { var err error + var count uint var SetProfiles []string nodeDB, err := node.New() @@ -100,8 +101,9 @@ func CobraRunE(cmd *cobra.Command, args []string) error { } if SetIpmiIpaddr != "" { - wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting IPMI IP address to: %s\n", n.Id.Get(), SetIpmiIpaddr) - n.IpmiIpaddr.Set(SetIpmiIpaddr) + NewIpaddr := util.IncrementIPv4(SetIpmiIpaddr, count) + wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting IPMI IP address to: %s\n", n.Id.Get(), NewIpaddr) + n.IpmiIpaddr.Set(NewIpaddr) } if SetIpmiNetmask != "" { @@ -189,8 +191,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error { n.NetDevs[SetNetName] = &nd } - wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting Ipaddr to: %s\n", n.Id.Get(), SetNetName, SetIpaddr) - n.NetDevs[SetNetName].Ipaddr.Set(SetIpaddr) + NewIpaddr := util.IncrementIPv4(SetIpaddr, count) + + wwlog.Printf(wwlog.VERBOSE, "Node: %s:%s, Setting Ipaddr to: %s\n", n.Id.Get(), SetNetName, NewIpaddr) + n.NetDevs[SetNetName].Ipaddr.Set(NewIpaddr) } if SetNetmask != "" { @@ -322,6 +326,8 @@ func CobraRunE(cmd *cobra.Command, args []string) error { wwlog.Printf(wwlog.ERROR, "%s\n", err) os.Exit(1) } + + count++ } if SetYes { diff --git a/internal/app/wwctl/node/set/root.go b/internal/app/wwctl/node/set/root.go index 527e7d8d..344b7c11 100644 --- a/internal/app/wwctl/node/set/root.go +++ b/internal/app/wwctl/node/set/root.go @@ -106,13 +106,13 @@ func init() { }); err != nil { log.Println(err) } - baseCmd.PersistentFlags().StringVar(&SetIpmiIpaddr, "ipmi", "", "Set the node's IPMI IP address") + baseCmd.PersistentFlags().StringVar(&SetIpmiIpaddr, "ipmiaddr", "", "Set the node's IPMI IP address") baseCmd.PersistentFlags().StringVar(&SetIpmiNetmask, "ipminetmask", "", "Set the node's IPMI netmask") baseCmd.PersistentFlags().StringVar(&SetIpmiPort, "ipmiport", "", "Set the node's IPMI port") baseCmd.PersistentFlags().StringVar(&SetIpmiGateway, "ipmigateway", "", "Set the node's IPMI gateway") baseCmd.PersistentFlags().StringVar(&SetIpmiUsername, "ipmiuser", "", "Set the node's IPMI username") baseCmd.PersistentFlags().StringVar(&SetIpmiPassword, "ipmipass", "", "Set the node's IPMI password") - baseCmd.PersistentFlags().StringVar(&SetIpmiInterface, "ipmiinterface", "", "Set the node's IPMI interface (defaults to 'lan' if empty)") + baseCmd.PersistentFlags().StringVar(&SetIpmiInterface, "ipmiinterface", "", "Set the node's IPMI interface (defaults: 'lan')") baseCmd.PersistentFlags().StringSliceVar(&SetAddProfile, "addprofile", []string{}, "Add Profile(s) to node") baseCmd.PersistentFlags().StringSliceVar(&SetDelProfile, "delprofile", []string{}, "Remove Profile(s) to node") baseCmd.PersistentFlags().StringVarP(&SetProfile, "profile", "P", "", "Set the node's profile members (comma separated)")