fixed deletion of network and deletion of tags

This commit is contained in:
Christian Goll
2022-09-01 10:08:31 +02:00
parent 255ff61dc8
commit 18eb531d4b
10 changed files with 144 additions and 55 deletions

View File

@@ -15,15 +15,13 @@ import (
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
// remove the default network as the all network values are assigned
// to this network
if NetName != "" {
netDev := *NodeConf.NetDevs["default"]
NodeConf.NetDevs[NetName] = &netDev
if NetName != "default" {
NodeConf.NetDevs[NetName] = NodeConf.NetDevs["default"]
delete(NodeConf.NetDevs, "default")
}
buffer, err := yaml.Marshal(NodeConf)
if err != nil {
wwlog.Error("Cant marshall nodeInfo", err)
wwlog.Error("Can't marshall nodeInfo", err)
os.Exit(1)
}
set := wwapiv1.NodeSetParameter{

View File

@@ -44,7 +44,7 @@ func init() {
NodeConf = node.NewConf()
NodeConf.CreateFlags(baseCmd, []string{})
baseCmd.PersistentFlags().StringVarP(&SetNetDevDel, "netdel", "D", "", "Delete the node's network device")
baseCmd.PersistentFlags().StringVar(&NetName, "netname", "", "Set network name for network options")
baseCmd.PersistentFlags().StringVar(&NetName, "netname", "default", "Set network name for network options")
baseCmd.PersistentFlags().BoolVarP(&SetNodeAll, "all", "a", false, "Set all nodes")
baseCmd.PersistentFlags().BoolVarP(&SetYes, "yes", "y", false, "Set 'yes' to all questions asked")
baseCmd.PersistentFlags().BoolVarP(&SetForce, "force", "f", false, "Force configuration (even on error)")