提交 1da0a370 编写于 作者: M Medya Gh

code review comments

上级 23ef3f6d
...@@ -97,9 +97,10 @@ func runDelete(cmd *cobra.Command, args []string) { ...@@ -97,9 +97,10 @@ func runDelete(cmd *cobra.Command, args []string) {
profileFlag := viper.GetString(config.MachineProfile) profileFlag := viper.GetString(config.MachineProfile)
validProfiles, invalidProfiles, err := pkg_config.ListProfiles() 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...) profilesToDelete := append(validProfiles, invalidProfiles...)
glog.Infof("error listing profiless %v", err) // in the case user has more than 1 profile and runs --purge
// If the purge flag is set, go ahead and delete the .minikube directory. // to prevent abandoned VMs/containers, force user to run with delete --all
if purge && len(profilesToDelete) > 1 && !deleteAll { if purge && len(profilesToDelete) > 1 && !deleteAll {
out.ErrT(out.Notice, "Multiple minikube profiles were found - ") out.ErrT(out.Notice, "Multiple minikube profiles were found - ")
for _, p := range profilesToDelete { for _, p := range profilesToDelete {
...@@ -115,7 +116,7 @@ func runDelete(cmd *cobra.Command, args []string) { ...@@ -115,7 +116,7 @@ func runDelete(cmd *cobra.Command, args []string) {
err := oci.DeleteAllVolumesByLabel(oci.Docker, fmt.Sprintf("%s=%s", oci.CreatedByLabelKey, "=true")) 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 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) errs := DeleteProfiles(profilesToDelete)
......
...@@ -23,7 +23,8 @@ import ( ...@@ -23,7 +23,8 @@ import (
"github.com/pkg/errors" "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 // example: docker volume prune -f --filter label=name.minikube.sigs.k8s.io=minikube
func DeleteAllVolumesByLabel(ociBin string, label string) error { func DeleteAllVolumesByLabel(ociBin string, label string) error {
glog.Infof("trying to prune all %s volumes with label %s", ociBin, label) glog.Infof("trying to prune all %s volumes with label %s", ociBin, label)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册