Fix devstack python detection if python3 is missing
On platforms without python3 installed devstack fails the python
version check. This does it more gracefully.
Change-Id: I4d79a41eb2d66852ab1a1aa8bd383f8e3e89cdc0
diff --git a/functions-common b/functions-common
index deebdec..b9bf0c9 100644
--- a/functions-common
+++ b/functions-common
@@ -2080,7 +2080,10 @@
function _get_python_version {
local interp=$1
local version
- version=$($interp -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
+ # disable erroring out here, otherwise if python 3 doesn't exist we fail hard.
+ if [[ -x $(which $interp) ]]; then
+ version=$($interp -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
+ fi
echo ${version}
}