Merge pull request #620 from mslacken/rel4.4rc3

Draft 0.4.4rc3 release
This commit is contained in:
Christian Goll
2022-12-22 15:18:16 +01:00
committed by GitHub
5 changed files with 21 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ VARLIST := OS
# Project Information # Project Information
VARLIST += WAREWULF VERSION RELEASE VARLIST += WAREWULF VERSION RELEASE
WAREWULF ?= warewulf WAREWULF ?= warewulf
VERSION ?= 4.4.0rc2 VERSION ?= 4.4.0rc3
GIT_TAG := $(shell test -e .git && git log -1 --format="%h") GIT_TAG := $(shell test -e .git && git log -1 --format="%h")
ifdef GIT_TAG ifdef GIT_TAG

View File

@@ -1,15 +1,24 @@
package delete package delete
import ( import (
"fmt"
"github.com/hpcng/warewulf/internal/pkg/api/container" "github.com/hpcng/warewulf/internal/pkg/api/container"
"github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1" "github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1"
"github.com/hpcng/warewulf/internal/pkg/api/util"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func CobraRunE(cmd *cobra.Command, args []string) (err error) { func CobraRunE(cmd *cobra.Command, args []string) (err error) {
cdp := &wwapiv1.ContainerDeleteParameter{ cdp := &wwapiv1.ContainerDeleteParameter{
ContainerNames: args, ContainerNames: args,
} }
if !SetYes {
yes := util.ConfirmationPrompt(fmt.Sprintf("Are you sure you want to container %s", args))
if !yes {
return
}
}
return container.ContainerDelete(cdp) return container.ContainerDelete(cdp)
} }

View File

@@ -8,10 +8,10 @@ import (
var ( var (
baseCmd = &cobra.Command{ baseCmd = &cobra.Command{
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Use: "delete [OPTIONS] CONTAINER [...]", Use: "delete [OPTIONS] CONTAINER [...]",
Short: "Delete an imported container", Short: "Delete an imported container",
Long: "This command will delete CONTAINERs that have been imported into Warewulf.", Long: "This command will delete CONTAINERs that have been imported into Warewulf.",
RunE: CobraRunE, RunE: CobraRunE,
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 { if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp return nil, cobra.ShellCompDirectiveNoFileComp
@@ -20,10 +20,11 @@ var (
return list, cobra.ShellCompDirectiveNoFileComp return list, cobra.ShellCompDirectiveNoFileComp
}, },
} }
SetYes bool
) )
func init() { func init() {
baseCmd.PersistentFlags().BoolVarP(&SetYes, "yes", "y", false, "Set 'yes' to all questions asked")
} }
// GetRootCommand returns the root cobra.Command for the application. // GetRootCommand returns the root cobra.Command for the application.

View File

@@ -25,6 +25,9 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
if err != nil { if err != nil {
return return
} }
if len(nodeList) == 0 {
return
}
yes := util.ConfirmationPrompt(fmt.Sprintf("Are you sure you want to delete %d nodes(s)", len(nodeList))) yes := util.ConfirmationPrompt(fmt.Sprintf("Are you sure you want to delete %d nodes(s)", len(nodeList)))
if !yes { if !yes {
return return

View File

@@ -58,6 +58,7 @@ func GetCommand() *cobra.Command {
}); err != nil { }); err != nil {
log.Println(err) log.Println(err)
} }
baseCmd.PersistentFlags().BoolVarP(&SetYes, "yes", "y", false, "Set 'yes' to all questions asked")
return baseCmd return baseCmd
} }