mirror of https://github.com/containers/podman.git
Update WSL backend to be compat with FCOS defaults
container/common Config was recently updated to use FCOS default names, since Windows HyperV backend needs them, and these are common with other providers. Map this to values the WSL backend expects. [NO NEW TESTS NEEDED] Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
This commit is contained in:
parent
9e14e3ebe5
commit
98e7d7af01
|
|
@ -331,3 +331,18 @@ func FCOSStreamFromString(s string) FCOSStream {
|
|||
}
|
||||
return Stable
|
||||
}
|
||||
|
||||
func IsValidFCOSStreamString(s string) bool {
|
||||
switch s {
|
||||
case Testing.String():
|
||||
fallthrough
|
||||
case Next.String():
|
||||
fallthrough
|
||||
case PodmanTesting.String():
|
||||
fallthrough
|
||||
case Stable.String():
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,13 @@ func (p *WSLVirtualization) NewMachine(opts machine.InitOptions) (machine.VM, er
|
|||
vm.ConfigPath = configPath
|
||||
vm.ImagePath = opts.ImagePath
|
||||
|
||||
// WSL uses a different username; here we hardcode it.
|
||||
vm.RemoteUsername = "user"
|
||||
// WSL historically uses a different username; translate "core" fcos default to
|
||||
// legacy "user" default
|
||||
if opts.Username == "" || opts.Username == "core" {
|
||||
vm.RemoteUsername = "user"
|
||||
} else {
|
||||
vm.RemoteUsername = opts.Username
|
||||
}
|
||||
|
||||
vm.Created = time.Now()
|
||||
vm.LastUp = vm.Created
|
||||
|
|
|
|||
|
|
@ -388,7 +388,8 @@ func downloadDistro(v *MachineVM, opts machine.InitOptions) error {
|
|||
err error
|
||||
)
|
||||
|
||||
if _, e := strconv.Atoi(opts.ImagePath); e == nil {
|
||||
// The default FCOS stream names are reserved indicators for the standard Fedora fetch
|
||||
if machine.IsValidFCOSStreamString(opts.ImagePath) {
|
||||
v.ImageStream = opts.ImagePath
|
||||
dd, err = NewFedoraDownloader(vmtype, v.Name, opts.ImagePath)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue