Skip to content

Commit

Permalink
cluster: add --force argument for prune subcommand (#1552)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis authored Sep 6, 2021
1 parent abd147a commit b718fb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/cluster/command/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ func newPruneCmd() *cobra.Command {
},
}

cmd.Flags().BoolVar(&gOpt.Force, "force", false, "Ignore errors when deleting the instance with data from the cluster")

return cmd
}
7 changes: 6 additions & 1 deletion pkg/cluster/operation/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,12 @@ func DestroyClusterTombstone(
instCount[instance.GetHost()]--
err := StopAndDestroyInstance(ctx, cluster, instance, options, instCount[instance.GetHost()] == 0)
if err != nil {
return err
if options.Force {
log.Warnf("failed to stop and destroy instance %s (%s), ignored as --force is set, you may need to manually cleanup the files",
instance, err)
} else {
return err
}
}
}
return nil
Expand Down

0 comments on commit b718fb0

Please sign in to comment.