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

fix: delete k1dir instead of kubeconfig file #2328

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cmd/k3d/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,8 @@ func destroyK3d(_ *cobra.Command, _ []string) error {
viper.WriteConfig()
}

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)
}
if err := os.RemoveAll(config.K1Dir); err != nil {
return fmt.Errorf("unable to delete %q: %w", config.K1Dir, err)
}
time.Sleep(200 * time.Millisecond)
fmt.Printf("Your kubefirst platform running in %q has been destroyed.", k3d.CloudProvider)
Expand Down
6 changes: 2 additions & 4 deletions cmd/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ func runReset() error {
return fmt.Errorf("error writing viper config: %w", err)
}

if _, err := os.Stat(k1Dir + "/kubeconfig"); !os.IsNotExist(err) {
if err := os.Remove(k1Dir + "/kubeconfig"); err != nil {
return fmt.Errorf("unable to delete %q folder, error: %w", k1Dir+"/kubeconfig", err)
}
if err := os.RemoveAll(k1Dir); err != nil {
return fmt.Errorf("unable to delete %q folder, error: %w", k1Dir, err)
}

progressPrinter.IncrementTracker("removing-platform-content")
Expand Down
Loading