Files
podman/pkg/machine/e2e/config_start_test.go
Brent Baude b4ec460ed4 Add update-connection to machine start and init
This allows users to set the associated machine's system connection to the system default when running `podman machine init --now` or `podman machine start`.  It also changes the default bbehavior of these commands in that the user will be prompted and asked if they would like to switch the system connection.  It also introduces a command line switch called `--update-connection`.  If the switch is unset, then the user will be prmpted.  If the command value is explicitly set to `false`, the user will not be prompted and the system connection will not be altered.  If the value is set to `true`, the system connection will be made the default and the user will not be prompted.

Fixes: https://issues.redhat.com/browse/RUN-3632

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-04 10:35:28 -06:00

52 lines
951 B
Go

package e2e_test
import (
"fmt"
"strconv"
)
type startMachine struct {
/*
No command line args other than a machine vm name (also not required)
*/
quiet bool
noInfo bool
updateConnection *bool
}
func (s *startMachine) buildCmd(m *machineTestBuilder) []string {
cmd := []string{"machine", "start"}
if len(m.name) > 0 {
cmd = append(cmd, m.name)
}
if s.quiet {
cmd = append(cmd, "--quiet")
}
if s.noInfo {
cmd = append(cmd, "--no-info")
}
if s.updateConnection != nil {
cmd = append(cmd, fmt.Sprintf("--update-connection=%s", strconv.FormatBool(*s.updateConnection)))
}
return cmd
}
func (s *startMachine) withQuiet() *startMachine {
s.quiet = true
return s
}
func (s *startMachine) withNoInfo() *startMachine {
s.noInfo = true
return s
}
func (s *startMachine) withUpdateConnection(value *bool) *startMachine {
s.updateConnection = value
return s
}
func ptrBool(v bool) *bool {
return &v
}