Don't uninstall pip packages if OFFLINE=True

lib/nova does a pip re-install of libvirt-python to rebuild the python
library incase the underlying libvirt version changed during package
installs.  In offline mode, the underlying version of libvirt can't
have changed; so we have the situation that we've removed the libvirt
python bindings but can't reinstall them (because we're offline).

This fixes that particular situation, but skipping uninstalls in
offline mode seems generically OK.

Change-Id: I2b75d45d94d82f87d996c7570c125d46f5f99f6a
Closes-Bug: #1708369
This commit is contained in:
Sampath Priyankara 2017-08-03 16:12:40 +09:00 committed by Ian Wienand
parent dea3083d98
commit 87d2396d22

View File

@ -346,6 +346,9 @@ function pip_install {
} }
function pip_uninstall { function pip_uninstall {
# Skip uninstall if offline
[[ "${OFFLINE}" = "True" ]] && return
local name=$1 local name=$1
if [[ -n ${PIP_VIRTUAL_ENV:=} && -d ${PIP_VIRTUAL_ENV} ]]; then if [[ -n ${PIP_VIRTUAL_ENV:=} && -d ${PIP_VIRTUAL_ENV} ]]; then
local cmd_pip=$PIP_VIRTUAL_ENV/bin/pip local cmd_pip=$PIP_VIRTUAL_ENV/bin/pip