Added ignorenotfound flag for all resources' deletion (#2293)
Treat \"resource not found\" as a successful delete if ignorenotfound flag passed while deletion of Fission resource.
This commit is contained in:
@@ -60,7 +60,7 @@ func Commands() *cobra.Command {
|
||||
}
|
||||
wrapper.SetFlags(deleteCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.MqtName},
|
||||
Optional: []flag.Flag{flag.NamespaceTrigger},
|
||||
Optional: []flag.Flag{flag.NamespaceTrigger, flag.IgnoreNotFound},
|
||||
})
|
||||
|
||||
listCmd := &cobra.Command{
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
|
||||
"github.com/fission/fission/pkg/fission-cli/cmd"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
)
|
||||
|
||||
type DeleteSubCommand struct {
|
||||
@@ -55,6 +56,9 @@ func (opts *DeleteSubCommand) complete(input cli.Input) error {
|
||||
func (opts *DeleteSubCommand) run(input cli.Input) error {
|
||||
err := opts.Client().V1().MessageQueueTrigger().Delete(opts.metadata)
|
||||
if err != nil {
|
||||
if input.Bool(flagkey.IgnoreNotFound) && util.IsNotFound(err) {
|
||||
return nil
|
||||
}
|
||||
return errors.Wrap(err, "error deleting message queue trigger")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user