If virtualenv is broken, force re-install it
The virtualenv_support folder missing from the repo container when upgrading due to the implementation in the repo_build role which removes it. In order to prevent breaking the virtualenv tooling, [1] is being submitted. However, we still need to handle the situation where the upgrade is done from a version before that patch is implemented. This patch implements a force-reinstallation of virtualenv if the folder is missing. [1] https://review.openstack.org/540351 Change-Id: I2dcfa1abb46ee4e088dac7c9e77e9772ba8a269e Closes-Bug: #1746935
This commit is contained in:
parent
4150e1ed4a
commit
610a4e6aa2
|
@ -24,10 +24,29 @@
|
|||
retries: 5
|
||||
delay: 5
|
||||
|
||||
# TODO(odyssey4me):
|
||||
# The following two tasks only applies to Pike->Queens upgrades,
|
||||
# so they can be removed in Rocky. See:
|
||||
# https://bugs.launchpad.net/openstack-ansible/+bug/1746935
|
||||
- name: List the current virtualenv_support folders in dist/site-packages
|
||||
find:
|
||||
file_type: any
|
||||
patterns: "virtualenv_support"
|
||||
paths:
|
||||
- "/usr/local/lib/python2.7/dist-packages"
|
||||
- "/usr/local/lib/python2.7/site-packages"
|
||||
register: _virtualenv_support
|
||||
|
||||
# TODO(odyssey4me):
|
||||
# We force a reinstall of the required pip packages when the
|
||||
# virtualenv_support folder is absent. This is to ensure that
|
||||
# we're able to create the venv properly for pypiserver.
|
||||
# The state ternary filter can be removed in Rocky as this is
|
||||
# only required for Pike->Queens upgrades.
|
||||
- name: Install required pip packages
|
||||
pip:
|
||||
name: "{{ repo_requires_pip_packages }}"
|
||||
state: "{{ repo_server_pip_package_state }}"
|
||||
state: "{{ (_virtualenv_support['matched'] | int > 0) | ternary(repo_server_pip_package_state, 'forcereinstall') }}"
|
||||
extra_args: >-
|
||||
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
|
||||
{{ pip_install_options | default('') }}
|
||||
|
|
Loading…
Reference in New Issue