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(pro): fixes an issue where remote workspace should be deleted if manually invoked and not when disconnecting a pro instance #1633

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
fix(pro): fixes an issue where remote workspace should be deleted if
manually invoked and not when disconnecting a pro instance
  • Loading branch information
pascalbreuninger committed Feb 10, 2025
commit 42e0f3def0d9482df3e427221c899dfaf1b3be9a
13 changes: 8 additions & 5 deletions cmd/provider/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync"

"github.com/loft-sh/devpod/cmd/flags"
"github.com/loft-sh/devpod/pkg/client"
"github.com/loft-sh/devpod/pkg/client/clientimplementation"
"github.com/loft-sh/devpod/pkg/config"
provider2 "github.com/loft-sh/devpod/pkg/provider"
"github.com/loft-sh/devpod/pkg/workspace"
Expand Down Expand Up @@ -99,10 +99,13 @@ func DeleteProvider(ctx context.Context, devPodConfig *config.Config, provider s
wg.Add(1)
go func(w provider2.Workspace) {
defer wg.Done()
_, err := workspace.Delete(ctx, devPodConfig, []string{w.ID}, true, false, client.DeleteOptions{
IgnoreNotFound: true,
Force: true,
}, logpkg.Discard)
client, err := workspace.Get(ctx, devPodConfig, []string{w.ID}, false, log)
if err != nil {
log.Errorf("Failed to get workspace %s: %v", w.ID, err)
return
}
// delete workspace folder
err = clientimplementation.DeleteWorkspaceFolder(devPodConfig.DefaultContext, client.Workspace(), client.WorkspaceConfig().SSHConfigPath, log)
if err != nil {
log.Errorf("Failed to delete workspace %s: %v", w.ID, err)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/workspace/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Delete(ctx context.Context, devPodConfig *config.Config, args []string, ign

// only remove local folder if workspace is imported or pro
workspaceConfig := client.WorkspaceConfig()
if !force && (workspaceConfig.Imported || workspaceConfig.IsPro()) {
if !force && workspaceConfig.Imported {
// delete workspace folder
err = clientimplementation.DeleteWorkspaceFolder(devPodConfig.DefaultContext, client.Workspace(), workspaceConfig.SSHConfigPath, log)
if err != nil {
Expand Down
Loading