Determine PYTHON3_VERSION when necessary

When grenade.sh is invoked by devstack-gate, PYTHON3_VERSION
is not set so grenadrc defaults it to 3.5, which breaks grenade
on nodes where python 3.5 does not exist, such as ubuntu bionic.

One solution is to set PYTHON3_VERSION in devstack-gate [1].
Alternatively, this change uses a bit of code borrowed from
stackrc in devstack to determine the version of python
within grenade if it was not set by the caller.

Closes-bug: #1812208
[1] https://review.openstack.org/#/c/607379/

Change-Id: I0349de2026c49279ba7f262d5e86d37018d66326
This commit is contained in:
Tom Barron 2019-01-15 07:43:33 -05:00
parent 9fe075e0bb
commit d5dc033a2e
2 changed files with 7 additions and 5 deletions

View File

@ -8,11 +8,6 @@ if [ -f $RC_DIR/localrc ]; then
source $RC_DIR/localrc
fi
# When Python 3 is supported by an application, adding the specific
# version of Python 3 to this variable will install the app using that
# version of the interpreter instead of 2.7.
export PYTHON3_VERSION=${PYTHON3_VERSION:-3.5}
# Base GIT Repo URL
# Another option is http://review.openstack.org/p
# Another option is https://github.com

View File

@ -276,6 +276,13 @@ function fetch_devstacks {
# it needs to be to have gotten this far.
source $TARGET_DEVSTACK_DIR/functions-common
source $TARGET_DEVSTACK_DIR/inc/python
# When Python 3 is supported by an application, adding the specific
# version of Python 3 to this variable will install the app using that
# version of the interpreter instead of 2.7.
_DEFAULT_PYTHON3_VERSION="$(_get_python_version python3)"
export PYTHON3_VERSION=${PYTHON3_VERSION:-${_DEFAULT_PYTHON3_VERSION:-3.5}}
install_devstack_tools
# Load up a copy of the downloaded images if not present