Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3790bb

Browse files
authored
fix: use provided username when fetching workspaces (#12955)
1 parent00fcf36 commitd3790bb

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

‎cli/open.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (r *RootCmd) openVSCode() *serpent.Command {
6464
// need to wait for the agent to start.
6565
workspaceQuery:=inv.Args[0]
6666
autostart:=true
67-
workspace,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,autostart,codersdk.Me,workspaceQuery)
67+
workspace,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,autostart,workspaceQuery)
6868
iferr!=nil {
6969
returnxerrors.Errorf("get workspace and agent: %w",err)
7070
}

‎cli/ping.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (r *RootCmd) ping() *serpent.Command {
4242
_,workspaceAgent,err:=getWorkspaceAndAgent(
4343
ctx,inv,client,
4444
false,// Do not autostart for a ping.
45-
codersdk.Me,workspaceName,
45+
workspaceName,
4646
)
4747
iferr!=nil {
4848
returnerr

‎cli/portforward.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (r *RootCmd) portForward() *serpent.Command {
7373
returnxerrors.New("no port-forwards requested")
7474
}
7575

76-
workspace,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,!disableAutostart,codersdk.Me,inv.Args[0])
76+
workspace,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,!disableAutostart,inv.Args[0])
7777
iferr!=nil {
7878
returnerr
7979
}

‎cli/speedtest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (r *RootCmd) speedtest() *serpent.Command {
3939
ctx,cancel:=context.WithCancel(inv.Context())
4040
defercancel()
4141

42-
_,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,false,codersdk.Me,inv.Args[0])
42+
_,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,false,inv.Args[0])
4343
iferr!=nil {
4444
returnerr
4545
}

‎cli/ssh.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (r *RootCmd) ssh() *serpent.Command {
157157
}
158158
}
159159

160-
workspace,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,!disableAutostart,codersdk.Me,inv.Args[0])
160+
workspace,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,!disableAutostart,inv.Args[0])
161161
iferr!=nil {
162162
returnerr
163163
}
@@ -551,10 +551,12 @@ startWatchLoop:
551551
// getWorkspaceAgent returns the workspace and agent selected using either the
552552
// `<workspace>[.<agent>]` syntax via `in`.
553553
// If autoStart is true, the workspace will be started if it is not already running.
554-
funcgetWorkspaceAndAgent(ctx context.Context,inv*serpent.Invocation,client*codersdk.Client,autostartbool,userIDstring,instring) (codersdk.Workspace, codersdk.WorkspaceAgent,error) {//nolint:revive
554+
funcgetWorkspaceAndAgent(ctx context.Context,inv*serpent.Invocation,client*codersdk.Client,autostartbool,inputstring) (codersdk.Workspace, codersdk.WorkspaceAgent,error) {//nolint:revive
555555
var (
556-
workspace codersdk.Workspace
557-
workspaceParts=strings.Split(in,".")
556+
workspace codersdk.Workspace
557+
// The input will be `owner/name.agent`
558+
// The agent is optional.
559+
workspaceParts=strings.Split(input,".")
558560
errerror
559561
)
560562

‎cli/vscodessh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (r *RootCmd) vscodeSSH() *serpent.Command {
110110
// will call this command after the workspace is started.
111111
autostart:=false
112112

113-
_,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,autostart,owner,name)
113+
_,workspaceAgent,err:=getWorkspaceAndAgent(ctx,inv,client,autostart,fmt.Sprintf("%s/%s",owner,name))
114114
iferr!=nil {
115115
returnxerrors.Errorf("find workspace and agent: %w",err)
116116
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp