Return non-zero exit code on node sub-commands
Signed-off-by: xu yang <xyang@ciq.com>
This commit is contained in:
@@ -17,14 +17,12 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
|
||||
nodeDB, err := node.New()
|
||||
if err != nil {
|
||||
wwlog.Error("Could not open node configuration: %s", err)
|
||||
os.Exit(1)
|
||||
return fmt.Errorf("could not open node configuration: %s", err)
|
||||
}
|
||||
|
||||
nodes, err := nodeDB.FindAllNodes()
|
||||
if err != nil {
|
||||
wwlog.Error("Could not get node list: %s", err)
|
||||
os.Exit(1)
|
||||
return fmt.Errorf("could not get node list: %s", err)
|
||||
}
|
||||
|
||||
args = hostlist.Expand(args)
|
||||
@@ -38,7 +36,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
if len(nodes) == 0 {
|
||||
fmt.Printf("No nodes found\n")
|
||||
wwlog.Info("No nodes found")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user