Only install python3 packages if necessary

In change I43de36ab570af40bc837d859568f5428c167f083, we started
installing the 'python3-' variants of the 'python-' packages installed
by the 'ceph-common' package in 'install_ceph_remote'. In that change,
we made the assertion that we didn't need to "both hiding this behind
the 'python3_enabled' function or 'USE_PYTHON3' variable since (a) these
packages can happily coexist, (b) projects should be switching to Python
3 now, and (c) using these would require sourcing additional, otherwise
unnecessary devstack libraries just to use this simple function".
However, this didn't take into account the fact that this plugin is not
versioned. This means *any* job that uses this plugin, including things
like stable/pike, will now attempt to install the 'python3-' packages.
Since the base OS on stable/pike, Xenial (16.04), doesn't actually
provide these 'python3-' variants, the command will always fail.

Start hiding the command behind a 'use_python3' function call. Hopefully
by time we drop Python 2 support here we won't have maintained branches
using Xenial. If we do, we'll need to branch or something like that.

Change-Id: I890a1e673fde212218eff4fcf82f7941b3283e5f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-Bug: #1853280
This commit is contained in:
Stephen Finucane 2019-11-20 13:11:06 +00:00
parent ee8cc0e9d4
commit 856dbe5280
1 changed files with 3 additions and 1 deletions

View File

@ -966,7 +966,9 @@ function install_ceph_remote {
# required packages, meaning we need to install the python3 variants
# manually. Hopefully this won't be necessary in Focal (20.04)
# https://packages.ubuntu.com/bionic/ceph-common
install_package python3-cephfs python3-prettytable python3-rados python3-rbd python3-requests
if python3_enabled; then
install_package python3-cephfs python3-prettytable python3-rados python3-rbd python3-requests
fi
}
# configure_repo_ceph() - Configure Ceph repositories