diff options
author | Brent Baude <bbaude@redhat.com> | 2021-08-16 09:48:29 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2021-08-16 10:02:48 -0500 |
commit | 440188f3b8eb1e6758b903030eea2a995e8bd522 (patch) | |
tree | 1b240cef480cbac76e4e8f6f2ac89047f4e561d0 | |
parent | a5adadf83b0f11c168563d1f26ebb7535cab4b9c (diff) | |
download | podman-440188f3b8eb1e6758b903030eea2a995e8bd522.tar.gz podman-440188f3b8eb1e6758b903030eea2a995e8bd522.tar.bz2 podman-440188f3b8eb1e6758b903030eea2a995e8bd522.zip |
fix gvproxy path search for macos
macos does not have /usr/libexec/ so we look in the executable paths
first.
Fixes: #11226
[NO TESTS NEEDED]
Signed-off-by: Brent Baude <bbaude@redhat.com>
-rw-r--r-- | pkg/machine/qemu/machine.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index a92892957..284ea1d7f 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -605,10 +605,15 @@ func CheckActiveVM() (bool, string, error) { // startHostNetworking runs a binary on the host system that allows users // to setup port forwarding to the podman virtual machine func (v *MachineVM) startHostNetworking() error { - // TODO we may wish to configure the directory in containers common - binary := filepath.Join("/usr/libexec/podman/", machine.ForwarderBinaryName) - if _, err := os.Stat(binary); err != nil { - return err + // MacOS does not have /usr/libexec so we look in the executable + // paths. + binary, err := exec.LookPath(machine.ForwarderBinaryName) + if errors.Cause(err) == exec.ErrNotFound { + // Nothing was found, so now check /usr/libexec, else error out + binary = filepath.Join("/usr/libexec/podman/", machine.ForwarderBinaryName) + if _, err := os.Stat(binary); err != nil { + return err + } } // Listen on all at port 7777 for setting up and tearing |