summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Konstanski <carlos.konstanski@verizonwireless.com>2020-01-17 23:06:45 +0000
committerCarlos Konstanski <carlos.konstanski@verizonwireless.com>2020-01-17 23:06:45 +0000
commit6af873ad53546a375ea25f7d59b6286f69347524 (patch)
treeaef69ff670fe23066d79bba02ce8f91be9cfec62
parent6e348b0d2df45c661f521958379affebbea851ac (diff)
detect correct python version for salt
-rwxr-xr-xbootstrap/run_salt.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/bootstrap/run_salt.sh b/bootstrap/run_salt.sh
index 59fd402..3977e9c 100755
--- a/bootstrap/run_salt.sh
+++ b/bootstrap/run_salt.sh
@@ -3,13 +3,27 @@
working_dir="${1}"
build_basedir="${2}"
local_build="${3}"
-python=$(which python3 || false)
salt_running_p() {
ps -ef | grep -F "salt-call" | grep -v "grep"
return ${?}
}
+python3_supported=$(python <<EOF
+try:
+ from salt.scripts import salt_call
+ print("success")
+except ImportError:
+ print("fail")
+EOF
+)
+
+if [ "${python3_supported}" == "success" ]; then
+ python=$(which python)
+else
+ python=$(which python2)
+fi
+
while salt_running_p; do
sleep 5
done