Skip to content
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

Merged
merged 6 commits into from
Jan 4, 2018
Merged

Add --all flag for deletes in cli #145

merged 6 commits into from
Jan 4, 2018

Conversation

the-redback
Copy link
Contributor

kubedb/project#106

}

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 {
Copy link
Contributor

@mirshahriar mirshahriar Jan 3, 2018

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

@@ -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 {
Copy link
Contributor

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

@@ -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)) {
Copy link
Contributor

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)

Copy link
Contributor

@mirshahriar mirshahriar left a 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

@tamalsaha tamalsaha merged commit bb5341e into master Jan 4, 2018
@tamalsaha tamalsaha deleted the delete-all branch January 4, 2018 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants