mirror of
https://github.com/containers/podman.git
synced 2025-10-14 17:55:51 +08:00
Move some logic of setRootful
to a common file
Moves most of the logic of `setRootful` to the common file `pkg/machine/machine_common.go`. Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
This commit is contained in:
@ -122,3 +122,24 @@ func WaitAPIAndPrintInfo(forwardState APIForwardingState, name, helper, forwardS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SetRootful modifies the machine's default connection to be either rootful or
|
||||
// rootless
|
||||
func SetRootful(rootful bool, name, rootfulName string) error {
|
||||
changeCon, err := AnyConnectionDefault(name, rootfulName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if changeCon {
|
||||
newDefault := name
|
||||
if rootful {
|
||||
newDefault += "-root"
|
||||
}
|
||||
err := ChangeDefault(newDefault)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user