Correct VM existance check on WSL

Replaces GetHyperVisorVMs() with Exists() to better abstract the underlying
use-case and slightly imrpove efficiency.

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
This commit is contained in:
Jason T. Greene
2024-02-13 21:37:56 -06:00
parent 07779e09f6
commit d23dd35dc1
6 changed files with 12 additions and 30 deletions

View File

@ -94,16 +94,8 @@ func (w WSLStubber) PrepareIgnition(_ *vmconfigs.MachineConfig, _ *ignition.Igni
return nil, nil
}
func (w WSLStubber) GetHyperVisorVMs() ([]string, error) {
vms, err := getAllWSLDistros(false)
if err != nil {
return nil, err
}
wslVMs := make([]string, 0)
for name := range vms {
wslVMs = append(wslVMs, name)
}
return wslVMs, nil
func (w WSLStubber) Exists(name string) (bool, error) {
return isWSLExist(machine.ToDist(name))
}
func (w WSLStubber) MountType() vmconfigs.VolumeMountType {