Skip to content

Commit

Permalink
Use sudo -n if --interactive=false (#19531)
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr authored Aug 30, 2024
1 parent 14c1ff4 commit 64eab73
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/minikube/firewall/firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"os/exec"
"regexp"
"runtime"
"slices"
"strings"

"github.com/spf13/viper"
Expand Down Expand Up @@ -65,7 +66,7 @@ func UnblockBootpd() error {
cmdString.WriteString(fmt.Sprintf(" $ %s \n", strings.Join(c.Args, " ")))
}

out.Styled(style.Permissions, "Your firewall is blocking bootpd which is required for socket_vmnet. The following commands will be executed to unblock bootpd:\n\n{{.commands}}\n", out.V{"commands": cmdString.String()})
out.Styled(style.Permissions, "Your firewall is blocking bootpd which is required for this configuration. The following commands will be executed to unblock bootpd:\n\n{{.commands}}\n", out.V{"commands": cmdString.String()})

for _, c := range cmds {
testArgs := append([]string{"-n"}, c.Args[1:]...)
Expand All @@ -75,6 +76,7 @@ func UnblockBootpd() error {
klog.Infof("%v may require a password: %v", c.Args, err)
if !viper.GetBool("interactive") {
klog.Warningf("%s requires a password, and --interactive=false", c.Args)
c.Args = slices.Insert(c.Args, 1, "-n")
}
}
klog.Infof("running: %s", c.Args)
Expand Down

0 comments on commit 64eab73

Please sign in to comment.