Skip to content

Commit 163a96b

Browse files
fix(pro): when running devpod ssh through another SSH client (--stdio)
we skip the remote workspace check as we don't need to let users select a remote one.
1 parent b48cca5 commit 163a96b

File tree

11 files changed

+54
-14
lines changed

11 files changed

+54
-14
lines changed

cmd/export.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func NewExportCmd(flags *flags.GlobalFlags) *cobra.Command {
4949
func (cmd *ExportCmd) Run(ctx context.Context, devPodConfig *config.Config, args []string) error {
5050
// try to load workspace
5151
logger := log.Default.ErrorStreamOnly()
52-
client, err := workspace2.Get(ctx, devPodConfig, args, false, cmd.Owner, logger)
52+
client, err := workspace2.Get(ctx, devPodConfig, args, false, cmd.Owner, false, logger)
5353
if err != nil {
5454
return err
5555
}

cmd/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (cmd *LogsCmd) Run(ctx context.Context, args []string) error {
4949
return err
5050
}
5151

52-
baseClient, err := workspace.Get(ctx, devPodConfig, args, false, cmd.Owner, log.Default)
52+
baseClient, err := workspace.Get(ctx, devPodConfig, args, false, cmd.Owner, false, log.Default)
5353
if err != nil {
5454
return err
5555
}

cmd/logs_daemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (cmd *LogsDaemonCmd) Run(ctx context.Context, args []string) error {
4242
return err
4343
}
4444

45-
baseClient, err := workspace.Get(ctx, devPodConfig, args, false, cmd.Owner, log.Default)
45+
baseClient, err := workspace.Get(ctx, devPodConfig, args, false, cmd.Owner, false, log.Default)
4646
if err != nil {
4747
return err
4848
} else if baseClient.WorkspaceConfig().Machine.ID == "" {

cmd/ping.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (cmd *PingCmd) Run(ctx context.Context, args []string) error {
4343
return err
4444
}
4545

46-
client, err := workspace2.Get(ctx, devPodConfig, args, true, cmd.Owner, log.Default.ErrorStreamOnly())
46+
client, err := workspace2.Get(ctx, devPodConfig, args, true, cmd.Owner, false, log.Default.ErrorStreamOnly())
4747
if err != nil {
4848
return err
4949
}

cmd/pro/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func cleanupLocalWorkspaces(ctx context.Context, devPodConfig *config.Config, wo
130130
wg.Add(1)
131131
go func(w provider.Workspace) {
132132
defer wg.Done()
133-
client, err := workspace.Get(ctx, devPodConfig, []string{w.ID}, true, owner, log)
133+
client, err := workspace.Get(ctx, devPodConfig, []string{w.ID}, true, owner, false, log)
134134
if err != nil {
135135
log.Errorf("Failed to get workspace %s: %v", w.ID, err)
136136
return

cmd/ssh.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,13 @@ func NewSSHCmd(f *flags.GlobalFlags) *cobra.Command {
7676
return err
7777
}
7878

79+
localOnly := false
80+
if cmd.Stdio {
81+
localOnly = true
82+
}
83+
7984
ctx := cobraCmd.Context()
80-
client, err := workspace2.Get(ctx, devPodConfig, args, true, cmd.Owner, log.Default.ErrorStreamOnly())
85+
client, err := workspace2.Get(ctx, devPodConfig, args, true, cmd.Owner, localOnly, log.Default.ErrorStreamOnly())
8186
if err != nil {
8287
return err
8388
}

cmd/status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func NewStatusCmd(flags *flags.GlobalFlags) *cobra.Command {
4747
}
4848

4949
logger := log.Default.ErrorStreamOnly()
50-
client, err := workspace2.Get(ctx, devPodConfig, args, false, cmd.Owner, logger)
50+
client, err := workspace2.Get(ctx, devPodConfig, args, false, cmd.Owner, false, logger)
5151
if err != nil {
5252
return err
5353
}

cmd/stop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func NewStopCmd(flags *flags.GlobalFlags) *cobra.Command {
4242
return fmt.Errorf("decode platform options: %w", err)
4343
}
4444

45-
client, err := workspace2.Get(ctx, devPodConfig, args, false, cmd.Owner, log.Default)
45+
client, err := workspace2.Get(ctx, devPodConfig, args, false, cmd.Owner, false, log.Default)
4646
if err != nil {
4747
return err
4848
}

cmd/troubleshoot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (cmd *TroubleshootCmd) Run(ctx context.Context, args []string) {
9999
info.Errors = append(info.Errors, PrintableError{fmt.Errorf("collect platform info: %w", err)})
100100
}
101101

102-
workspaceClient, err := workspace.Get(ctx, info.Config, args, false, cmd.Owner, logger)
102+
workspaceClient, err := workspace.Get(ctx, info.Config, args, false, cmd.Owner, false, logger)
103103
if err == nil {
104104
info.Workspace = workspaceClient.WorkspaceConfig()
105105
info.WorkspaceStatus, err = workspaceClient.Status(ctx, client.StatusOptions{})

pkg/workspace/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
func Delete(ctx context.Context, devPodConfig *config.Config, args []string, ignoreNotFound, force bool, deleteOptions client2.DeleteOptions, owner platform.OwnerFilter, log log.Logger) (string, error) {
1616
// try to load workspace
17-
client, err := Get(ctx, devPodConfig, args, false, owner, log)
17+
client, err := Get(ctx, devPodConfig, args, false, owner, false, log)
1818
if err != nil {
1919
if len(args) == 0 {
2020
return "", fmt.Errorf("cannot delete workspace because there was an error loading the workspace: %w. Please specify the id of the workspace you want to delete. E.g. 'devpod delete my-workspace --force'", err)

0 commit comments

Comments
 (0)