Skip to content

Commit

Permalink
Merge pull request #20508 from vrothberg/fix-20502
Browse files Browse the repository at this point in the history
compose: try all possible providers before throwing an error
  • Loading branch information
openshift-ci[bot] authored Oct 27, 2023
2 parents 09c64ef + 3743955 commit 95fc004
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cmd/podman/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"github.com/containers/common/pkg/config"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/pkg/errorhandling"
"github.com/containers/podman/v4/pkg/machine"
"github.com/containers/podman/v4/pkg/machine/provider"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -85,20 +86,19 @@ func composeProvider() (string, error) {
return "", errors.New("no compose provider specified, please refer to `man podman-compose` for details")
}

lookupErrors := make([]error, 0, len(candidates))
for _, candidate := range candidates {
path, err := exec.LookPath(os.ExpandEnv(candidate))
if err != nil {
if errors.Is(err, os.ErrNotExist) {
continue
}
return "", err
if err == nil {
// First specified provider "candidate" wins.
logrus.Debugf("Found compose provider %q", path)
return path, nil
}
// First specified provider "candidate" wins.
logrus.Debugf("Found compose provider %q", path)
return path, nil
logrus.Debugf("Error looking up compose provider %q: %v", path, err)
lookupErrors = append(lookupErrors, err)
}

return "", errors.New("no configured compose provider found on system, please refer to the documentation for details")
return "", fmt.Errorf("looking up compose provider failed\n%v", errorhandling.JoinErrors(lookupErrors))
}

// composeDockerHost returns the value to be set in the DOCKER_HOST environment
Expand Down

2 comments on commit 95fc004

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

@lsm5
Copy link
Member

@lsm5 lsm5 commented on 95fc004 Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

golang proxy flake. rebuilding now..

Please sign in to comment.