-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --all flag for deletes in cli #145
Conversation
pkg/cmds/delete.go
Outdated
} | ||
|
||
func deleteResult(cmd *cobra.Command, r *resource.Result, out io.Writer, mapper meta.RESTMapper) error { | ||
func deleteResult(cmd *cobra.Command, r *resource.Result, out io.Writer, mapper meta.RESTMapper, deleteAll bool) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get deleteAll flag from cmd
pkg/cmds/delete.go
Outdated
@@ -129,7 +132,10 @@ func deleteResult(cmd *cobra.Command, r *resource.Result, out io.Writer, mapper | |||
|
|||
for _, info := range infoList { | |||
if err := deleteResource(info, out, mapper, shortOutput, forceDeletion); err != nil { | |||
return err | |||
if !deleteAll { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not need this. User will retry if fails
pkg/cmds/delete.go
Outdated
@@ -154,7 +160,9 @@ func deleteResource(info *resource.Info, out io.Writer, mapper meta.RESTMapper, | |||
) | |||
} | |||
if err := resource.NewHelper(info.Client, info.Mapping).Delete(info.Namespace, info.Name); err != nil { | |||
return cmdutil.AddSourceToErr("deleting", info.Source, err) | |||
if !forceDeletion || (forceDeletion && !kerr.IsNotFound(err)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just check !kerr.IsNotFound(err)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an example for --force --all
kubedb/project#106