Skip to content

Commit

Permalink
added validation for auto-pause-interval start flag
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed Feb 15, 2024
1 parent 83076e3 commit a5e44b1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"sort"
"strconv"
"strings"
"time"

"github.com/Delta456/box-cli-maker/v2"
"github.com/blang/semver/v4"
Expand Down Expand Up @@ -1315,6 +1316,12 @@ func validateFlags(cmd *cobra.Command, drvName string) {
}
}

if cmd.Flags().Changed(autoPauseInterval) {
if err := validateAutoPauseInterval(viper.GetDuration(autoPauseInterval)); err != nil {
exit.Message(reason.Usage, "{{.err}}", out.V{"err": err})
}
}

if driver.IsSSH(drvName) {
sshIPAddress := viper.GetString(sshIPAddress)
if sshIPAddress == "" {
Expand Down Expand Up @@ -1476,6 +1483,13 @@ func validateGPUsArch() error {
return errors.Errorf("The GPUs flag is only supported on amd64, arm64 & ppc64le, currently using %s", runtime.GOARCH)
}

func validateAutoPauseInterval(interval time.Duration) error {
if interval != interval.Abs() || interval.String() == "0s" {
return errors.New("auto-pause-interval must be greater than 0s")
}
return nil
}

func getContainerRuntime(old *config.ClusterConfig) string {
paramRuntime := viper.GetString(containerRuntime)

Expand Down

0 comments on commit a5e44b1

Please sign in to comment.