Skip to content

Commit

Permalink
code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
medyagh committed Feb 17, 2020
1 parent 23ef3f6 commit 1da0a37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cmd/minikube/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ func runDelete(cmd *cobra.Command, args []string) {
profileFlag := viper.GetString(config.MachineProfile)

validProfiles, invalidProfiles, err := pkg_config.ListProfiles()
glog.Warningf("Couldn't find any profiles in minikube home %q: %v", localpath.MiniPath(), err)
profilesToDelete := append(validProfiles, invalidProfiles...)
glog.Infof("error listing profiless %v", err)
// If the purge flag is set, go ahead and delete the .minikube directory.
// in the case user has more than 1 profile and runs --purge
// to prevent abandoned VMs/containers, force user to run with delete --all
if purge && len(profilesToDelete) > 1 && !deleteAll {
out.ErrT(out.Notice, "Multiple minikube profiles were found - ")
for _, p := range profilesToDelete {
Expand All @@ -115,7 +116,7 @@ func runDelete(cmd *cobra.Command, args []string) {

err := oci.DeleteAllVolumesByLabel(oci.Docker, fmt.Sprintf("%s=%s", oci.CreatedByLabelKey, "=true"))
if err != nil { // if there is no volume there won't be any error
glog.Warningf("error deleting left docker volumes. To see the list of volumes run: 'docker volume ls' \n%v:", err)
glog.Warningf("error deleting left docker volumes. \n%v:\nfor more information please refer to docker documentation: https://docs.docker.com/engine/reference/commandline/volume_prune/", err)
}

errs := DeleteProfiles(profilesToDelete)
Expand Down
3 changes: 2 additions & 1 deletion pkg/drivers/kic/oci/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import (
"github.com/pkg/errors"
)

// DeleteAllVolumesByLabel delets all volumes that have a specific label
// DeleteAllVolumesByLabel deletes all volumes that have a specific label
// if there is no volume to delete it will return nil
// example: docker volume prune -f --filter label=name.minikube.sigs.k8s.io=minikube
func DeleteAllVolumesByLabel(ociBin string, label string) error {
glog.Infof("trying to prune all %s volumes with label %s", ociBin, label)
Expand Down

0 comments on commit 1da0a37

Please sign in to comment.