Skip to content

Commit

Permalink
Actually default-yes for installing dashboard
Browse files Browse the repository at this point in the history
The instructions and the implementation didn't line up - we claimed
yes was default, but just hitting enter caused the value to be ""
which meant we didn't actually install it.

This is caused by using `IsConfirm`, where it doesn't set the default
as the default value, but rather uses the error value as `nil` if the
user agreed, and promptui.ErrAbort (which is `errors.New("")`) if the
user didn't.
  • Loading branch information
Robin Sonefors committed Oct 11, 2022
1 parent 5c7023e commit 20c2f1d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/gitops/beta/run/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package run
import (
"context"
"fmt"
"github.com/weaveworks/weave-gitops/pkg/kube"
"os"
"os/signal"
"path/filepath"
"strings"
"sync/atomic"
"syscall"
"time"
Expand All @@ -22,6 +20,7 @@ import (
clilogger "github.com/weaveworks/weave-gitops/cmd/gitops/logger"
"github.com/weaveworks/weave-gitops/pkg/fluxexec"
"github.com/weaveworks/weave-gitops/pkg/fluxinstall"
"github.com/weaveworks/weave-gitops/pkg/kube"
"github.com/weaveworks/weave-gitops/pkg/run"
"github.com/weaveworks/weave-gitops/pkg/run/bootstrap"
"github.com/weaveworks/weave-gitops/pkg/run/install"
Expand Down Expand Up @@ -339,8 +338,10 @@ func runCommandWithoutSession(cmd *cobra.Command, args []string) error {
Default: "Y",
}

result, err := prompt.Run()
if err == nil && strings.ToUpper(result) == "Y" {
// Answering "n" causes err to not be nil. Hitting enter without typping
// does not return the default.
_, err := prompt.Run()
if err == nil {
password, err := install.ReadPassword(log)
if err != nil {
return err
Expand Down

0 comments on commit 20c2f1d

Please sign in to comment.