Fix pip distro package removal for focal

Ubuntu Focal doesn't have python-pip, only python3-pip. Trying to
uninstall a package that apt doesn't know about (installed or
uninstalled) results in a nonzero exit code so devstack fails. This
patch makes the package removal safer for both python2 and python3 cases
by checking first if the package exists.

Change-Id: I3b1118888cb0617ffb99b72c7e9a32308033783e
This commit is contained in:
Colleen Murphy 2020-05-11 18:28:32 -07:00
parent 53c2f6fe23
commit 782efb0f8a

View File

@ -133,8 +133,12 @@ get_versions
# results in a nonfunctional system. pip on fedora installs to /usr so pip
# can safely override the system pip for all versions of fedora
if ! is_fedora && ! is_suse; then
uninstall_package python-pip
uninstall_package python3-pip
if is_package_installed python-pip ; then
uninstall_package python-pip
fi
if is_package_installed python3-pip ; then
uninstall_package python3-pip
fi
fi
install_get_pip