MCPcopy
hub / github.com/loft-sh/devpod / DeleteWorkspaceFolder

Function DeleteWorkspaceFolder

pkg/client/clientimplementation/workspace_client.go:627–651  ·  view source on GitHub ↗
(context string, workspaceID string, sshConfigPath string, log log.Logger)

Source from the content-addressed store, hash-verified

625}
626
627func DeleteWorkspaceFolder(context string, workspaceID string, sshConfigPath string, log log.Logger) error {
628 path, err := ssh.ResolveSSHConfigPath(sshConfigPath)
629 if err != nil {
630 return err
631 }
632 sshConfigPath = path
633
634 err = ssh.RemoveFromConfig(workspaceID, sshConfigPath, log)
635 if err != nil {
636 log.Errorf("Remove workspace '%s' from ssh config: %v", workspaceID, err)
637 }
638
639 workspaceFolder, err := provider.GetWorkspaceDir(context, workspaceID)
640 if err != nil {
641 return err
642 }
643
644 // remove workspace folder
645 err = os.RemoveAll(workspaceFolder)
646 if err != nil && !os.IsNotExist(err) {
647 return err
648 }
649
650 return nil
651}

Callers 8

resolveWorkspaceFunction · 0.92
DeleteFunction · 0.92
deleteSingleMachineFunction · 0.92
ListFunction · 0.92
DeleteProviderFunction · 0.92
RunMethod · 0.92
DeleteMethod · 0.85
DeleteMethod · 0.85

Calls 4

ResolveSSHConfigPathFunction · 0.92
RemoveFromConfigFunction · 0.92
GetWorkspaceDirFunction · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected