Return non-zero exit code on node sub-commands

Signed-off-by: xu yang <xyang@ciq.com>
This commit is contained in:
xu yang
2024-09-26 06:15:02 +00:00
parent eb2fab9902
commit 3f120f2c4b
8 changed files with 31 additions and 54 deletions

View File

@@ -2,7 +2,6 @@ package set
import (
"fmt"
"os"
"strings"
"github.com/spf13/cobra"
@@ -54,8 +53,7 @@ func CobraRunE(vars *variables) func(cmd *cobra.Command, args []string) (err err
delete(vars.nodeConf.Disks, "UNDEF")
buffer, err := yaml.Marshal(vars.nodeConf)
if err != nil {
wwlog.Error("Can't marshall nodeInfo", err)
os.Exit(1)
return fmt.Errorf("can not marshall nodeInfo: %s", err)
}
wwlog.Debug("sending following values: %s", string(buffer))
set := wwapiv1.NodeSetParameter{