hacking/env-setup prefixes not working on Mac with Ansible install

Hi

hacking/env-setup does not work for me. I’m on a Mac with a previous installation of Ansible via homebrew. The cause is easy to spot, but I’m wondering if there is a specific reason why it is setup in this way.

Before running env-setup:
which ansible > /usr/local/bin/ansible

echo $PATH > /Users/magnus/google-cloud-sdk/bin:/usr/local/bin:/usr/local/share/npm/bin/:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

I have ansible at the end of my path env variable.

Running env-setup:

PATH=/Users/magnus/Documents/Programmering/Magnusart/ansible/bin:/Users/magnus/google-cloud-sdk/bin:/usr/local/bin:/usr/local/share/npm/bin/:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

which ansible > /usr/local/bin/ansible

Since the hacking env-setup prefixes the path instead of postfixing the current installation of ansible is still active.

Looking in env-setup it prefixes the PATH with the path to the development instance of ansible, is there a particular purpose for this?

/Magnus

“Since the hacking env-setup prefixes the path instead of postfixing the current installation of ansible is still active.”

Doesn’t compute.

First path wins in PATH, not the last, so prefixing is entirely correct.

http://en.wikipedia.org/wiki/PATH_(variable)

Hi

You’re right blush.

I did figure it was very strange since I also remembered that prefix would win, but I did try it out before posting. Now I see that the issue must be something else since it seems /usr/local/bin/ansible is called both before and after running env-setup (I’m in the same session so I’m very confused).

I must be tired, gonna give this a new try.

/Magnus

The problem is that it does not get set at all. It looks as if it was judging by the output but when echoing $PATH it is not present. I was fooled by the output from the script.

When I add the path manually (export PATH=mypath:$PATH) it works.

/Magnus

You need to source the script not just run it.

– Michael

Ah! There we go. Thanks.