Skip to content

Commit 5131129

Browse files
committed
Revert "confirm before stop"
This reverts commit c33f9b9.
1 parent 4476b6a commit 5131129

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

cli/update.go

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,13 @@ func (r *RootCmd) update() *serpent.Command {
3939
// updating. Simply performing a new start transition may not work if the
4040
// template specifies ignore_changes.
4141
if workspace.LatestBuild.Transition == codersdk.WorkspaceTransitionStart {
42-
// It's polite to ask the user before stopping their workspace.
43-
cliui.Info(inv.Stdout, "Your workspace is currently running. We recommend stopping it before proceeding.")
44-
if _, err := cliui.Prompt(inv, cliui.PromptOptions{
45-
Text: "Confirm stop workspace?",
46-
IsConfirm: true,
47-
}); err != nil {
48-
cliui.Warnf(inv.Stderr, "Updating without stop.")
49-
} else {
50-
build, err := stopWorkspace(inv, client, workspace, bflags)
51-
if err != nil {
52-
return xerrors.Errorf("stop workspace: %w", err)
53-
}
54-
// Wait for the stop to complete.
55-
if err := cliui.WorkspaceBuild(inv.Context(), inv.Stdout, client, build.ID); err != nil {
56-
return xerrors.Errorf("wait for stop: %w", err)
57-
}
42+
build, err := stopWorkspace(inv, client, workspace, bflags)
43+
if err != nil {
44+
return xerrors.Errorf("stop workspace: %w", err)
45+
}
46+
// Wait for the stop to complete.
47+
if err := cliui.WorkspaceBuild(inv.Context(), inv.Stdout, client, build.ID); err != nil {
48+
return xerrors.Errorf("wait for stop: %w", err)
5849
}
5950
}
6051

cli/update_test.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,8 @@ func TestUpdate(t *testing.T) {
7171
inv, root := clitest.New(t, "update", ws.Name)
7272
clitest.SetupConfig(t, member, root)
7373

74-
doneCh := make(chan error)
75-
pty := ptytest.New(t).Attach(inv)
76-
go func() {
77-
defer close(doneCh)
78-
doneCh <- inv.Run()
79-
}()
80-
81-
pty.ExpectMatch("Confirm stop workspace?")
82-
pty.WriteLine("yes")
83-
require.NoError(t, testutil.TryReceive(ctx, t, doneCh), "update command failed to run")
74+
err = inv.Run()
75+
require.NoError(t, err, "update command failed")
8476

8577
// Then: the workspace is no longer 'outdated'
8678
ws, err = member.WorkspaceByOwnerAndName(ctx, codersdk.Me, "my-workspace", codersdk.WorkspaceOptions{})

0 commit comments

Comments
 (0)