Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use python version define in PY_BIN if it exists #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/ansible-cmdb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ dbg () {

# Find suitable python binary
find_py_bin () {
which -a python | while read -r TRY_PY_BIN
if [ -x "$PY_BIN" ]; then
PY_OPTIONS="$PY_BIN\n$(which -a python python3)"
else
PY_OPTIONS="$(which -a python python3)"
fi
printf "$PY_OPTIONS" | while read -r TRY_PY_BIN
do
dbg "Trying python bin: $TRY_PY_BIN"

Expand Down Expand Up @@ -51,8 +56,8 @@ if [ "$1" = "-d" ] || [ "$1" = "--debug" ]; then
DEBUG=1
fi

PY_BIN="$(find_py_bin)"
if [ -z "$PY_BIN" ]; then
PY_CHOICE="$(find_py_bin)"
if [ -z "$PY_CHOICE" ]; then
echo "No suitable python version found (v2.7 or higher required). Aborting" >&2
exit 1
fi
Expand Down