e827ec702e
include the lib/ directory. Before - PYTHONPATH is empty.. ansible fails to run $ source hacking/env-setup.fish Appending PYTHONPATH Setting up Ansible to run out of checkout... PATH=/Volumes/opt/src/ansible/bin /usr/local/share/python3 /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin /usr/bin /sbin /usr/local/bin /Users/ms/bin/ PYTHONPATH= ANSIBLE_LIBRARY=/Volumes/opt/src/ansible/library ... Traceback (most recent call last): File "/Volumes/opt/src/ansible/bin/ansible", line 25, in <module> from ansible.runner import Runner ImportError: No module named ansible.runner After change - it's set.. ansible runs. source hacking/env-setup.fish Appending PYTHONPATH Setting up Ansible to run out of checkout... PATH=/Volumes/opt/src/ansible/bin /usr/local/share/python3 /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin /usr/bin /sbin /usr/local/bin /Users/ms/bin/ PYTHONPATH=/Volumes/opt/src/ansible/lib: ANSIBLE_LIBRARY=/Volumes/opt/src/ansible/library .... $ ansible Usage: ansible <host-pattern> [options]
57 lines
1.4 KiB
Fish
57 lines
1.4 KiB
Fish
#!/usr/bin/env fish
|
|
# usage: . ./hacking/env-setup [-q]
|
|
# modifies environment for running Ansible from checkout
|
|
set HACKING_DIR (dirname (status -f))
|
|
set FULL_PATH (python -c "import os; print(os.path.realpath('$HACKING_DIR'))")
|
|
set ANSIBLE_HOME (dirname $FULL_PATH)
|
|
set PREFIX_PYTHONPATH $ANSIBLE_HOME/lib
|
|
set PREFIX_PATH $ANSIBLE_HOME/bin
|
|
set PREFIX_MANPATH $ANSIBLE_HOME/docs/man
|
|
|
|
# Set PYTHONPATH
|
|
if not set -q PYTHONPATH
|
|
set -gx PYTHONPATH $PREFIX_PYTHONPATH
|
|
else
|
|
switch PYTHONPATH
|
|
case "$PREFIX_PYTHONPATH*"
|
|
case "*"
|
|
echo "Appending PYTHONPATH"
|
|
set -gx PYTHONPATH "$PREFIX_PYTHONPATH:$PYTHONPATH"
|
|
end
|
|
end
|
|
|
|
# Set PATH
|
|
if not contains $PREFIX_PATH $PATH
|
|
set -gx PATH $PREFIX_PATH $PATH
|
|
end
|
|
|
|
# Set MANPATH
|
|
if not contains $PREFIX_MANPATH $MANPATH
|
|
if not set -q MANPATH
|
|
set -gx MANPATH $PREFIX_MANPATH
|
|
else
|
|
set -gx MANPATH $PREFIX_MANPATH $MANPATH
|
|
end
|
|
end
|
|
|
|
set -gx ANSIBLE_LIBRARY $ANSIBLE_HOME/library
|
|
|
|
if set -q argv
|
|
switch $argv
|
|
case '-q' '--quiet'
|
|
case '*'
|
|
echo ""
|
|
echo "Setting up Ansible to run out of checkout..."
|
|
echo ""
|
|
echo "PATH=$PATH"
|
|
echo "PYTHONPATH=$PYTHONPATH"
|
|
echo "ANSIBLE_LIBRARY=$ANSIBLE_LIBRARY"
|
|
echo "MANPATH=$MANPATH"
|
|
echo ""
|
|
|
|
echo "Remember, you may wish to specify your host file with -i"
|
|
echo ""
|
|
echo "Done!"
|
|
echo ""
|
|
end
|
|
end
|