diff --git a/go.mod b/go.mod index 6ef7a6ed495..deaf3190e3e 100644 --- a/go.mod +++ b/go.mod @@ -71,7 +71,7 @@ require ( go.etcd.io/etcd/client/v3 v3.5.7 // indirect google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect - k8s.io/cloud-provider v0.0.0 // indirect + k8s.io/cloud-provider v0.27.4 // indirect k8s.io/controller-manager v0.27.4 // indirect k8s.io/cri-api v0.27.4 // indirect k8s.io/kms v0.27.4 // indirect diff --git a/pkg/utils/confirm/confirm.go b/pkg/utils/confirm/confirm.go index 31d93b97720..c75b0beb597 100644 --- a/pkg/utils/confirm/confirm.go +++ b/pkg/utils/confirm/confirm.go @@ -16,7 +16,7 @@ package confirm import ( "errors" - "regexp" + "os" "github.com/manifoldco/promptui" @@ -25,14 +25,13 @@ import ( // Confirm is send the prompt and get result func Confirm(prompt, cancel string) (bool, error) { - var yesRx = regexp.MustCompile("^(?:y(?:es)?)$") - var noRx = regexp.MustCompile("^(?:n(?:o)?)$") - promptLabel := "Yes [y/yes], No [n/no]" + var hostname, _ = os.Hostname() + promptLabel := "Do you want to continue on '" + hostname + "' cluster? Input '" + hostname + "' to continue" logger.Info(prompt) validate := func(input string) error { - if !yesRx.MatchString(input) && !noRx.MatchString(input) { - return errors.New("invalid input, please enter 'y', 'yes', 'n', or 'no'") + if input != hostname { + return errors.New("invalid input, please enter " + hostname + " to continue") } return nil } @@ -47,7 +46,7 @@ func Confirm(prompt, cancel string) (bool, error) { return false, err } - if yesRx.MatchString(result) { + if result == hostname { return true, nil } logger.Warn(cancel)