Skip to content

Commit

Permalink
fix: delete k1dir instead of kubeconfig file
Browse files Browse the repository at this point in the history
  • Loading branch information
jokestax committed Nov 4, 2024
1 parent 9d3f1bc commit e196162
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/k3d/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ func destroyK3d(_ *cobra.Command, _ []string) error {
viper.WriteConfig()
}

if _, err := os.Stat(config.K1Dir + "/kubeconfig"); !os.IsNotExist(err) {
if err := os.Remove(config.K1Dir + "/kubeconfig"); err != nil {
return fmt.Errorf("unable to delete %q: %w", config.K1Dir+"/kubeconfig", err)
if _, err := os.Stat(config.K1Dir); !os.IsNotExist(err) {
if err := os.RemoveAll(config.K1Dir); err != nil {
return fmt.Errorf("unable to delete %q: %w", config.K1Dir, err)
}
}
time.Sleep(200 * time.Millisecond)
Expand Down

0 comments on commit e196162

Please sign in to comment.