Skip to content
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