Return non-zero exit code on profile sub-commands

Signed-off-by: xu yang <xyang@ciq.com>
This commit is contained in:
xu yang
2024-09-30 05:40:09 +00:00
committed by Jonathon Anderson
parent 3178e338a7
commit 139b9880a0
5 changed files with 11 additions and 24 deletions

View File

@@ -6,7 +6,6 @@ import (
apiprofile "github.com/warewulf/warewulf/internal/pkg/api/profile"
"github.com/warewulf/warewulf/internal/pkg/node"
"github.com/warewulf/warewulf/internal/pkg/wwlog"
"gopkg.in/yaml.v3"
"github.com/spf13/cobra"
@@ -47,8 +46,7 @@ func CobraRunE(vars *variables) func(cmd *cobra.Command, args []string) (err err
delete(vars.profileConf.Disks, "UNDEF")
buffer, err := yaml.Marshal(vars.profileConf)
if err != nil {
wwlog.Error("Can't marshall nodeInfo", err)
return err
return fmt.Errorf("can not marshall nodeInfo: %w", err)
}
set := wwapiv1.NodeAddParameter{
NodeConfYaml: string(buffer[:]),