mirror of
https://github.com/containers/podman.git
synced 2025-11-28 17:18:58 +08:00
Tremendous amount of changes in here, but all should amount to the same thing: changing Go import paths from v5 to v6. Also bumped go.mod to github.com/containers/podman/v6 and updated version to v6.0.0-dev. Signed-off-by: Matt Heon <mheon@redhat.com>
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package provider
|
|
|
|
import (
|
|
"github.com/containers/podman/v6/pkg/machine/define"
|
|
"github.com/containers/podman/v6/pkg/machine/env"
|
|
"github.com/containers/podman/v6/pkg/machine/vmconfigs"
|
|
)
|
|
|
|
func InstalledProviders() ([]define.VMType, error) {
|
|
installedTypes := []define.VMType{}
|
|
providers := GetAll()
|
|
for _, p := range providers {
|
|
installed, err := IsInstalled(p.VMType())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if installed {
|
|
installedTypes = append(installedTypes, p.VMType())
|
|
}
|
|
}
|
|
return installedTypes, nil
|
|
}
|
|
|
|
// GetAllMachinesAndRootfulness collects all podman machine configs and returns
|
|
// a map in the format: { machineName: isRootful }
|
|
func GetAllMachinesAndRootfulness() (map[string]bool, error) {
|
|
providers := GetAll()
|
|
machines := map[string]bool{}
|
|
for _, provider := range providers {
|
|
dirs, err := env.GetMachineDirs(provider.VMType())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
providerMachines, err := vmconfigs.LoadMachinesInDir(dirs)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
for n, m := range providerMachines {
|
|
machines[n] = m.HostUser.Rootful
|
|
}
|
|
}
|
|
|
|
return machines, nil
|
|
}
|