Merge pull request #20478 from lstocchi/i20373

fix: check npipe when executing podman compose on wsl vm
This commit is contained in:
openshift-ci[bot] 2023-10-26 10:15:49 +00:00 committed by GitHub
commit 642c0c798a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -184,12 +184,18 @@ func composeDockerHost() (string, error) {
if err != nil {
return "", fmt.Errorf("inspecting machine: %w", err)
}
if info.ConnectionInfo.PodmanSocket == nil {
return "", errors.New("socket of machine is not set")
}
if info.State != machine.Running {
return "", fmt.Errorf("machine %s is not running but in state %s", item.Name, info.State)
}
if machineProvider.VMType() == machine.WSLVirt {
if info.ConnectionInfo.PodmanPipe == nil {
return "", errors.New("pipe of machine is not set")
}
return strings.Replace(info.ConnectionInfo.PodmanPipe.Path, `\\.\pipe\`, "npipe:////./pipe/", 1), nil
}
if info.ConnectionInfo.PodmanSocket == nil {
return "", errors.New("socket of machine is not set")
}
return "unix://" + info.ConnectionInfo.PodmanSocket.Path, nil
}