Browse code

Don't reinstall python-virtualenv on infra nodes

In the original change I said "for infra nodes, it shouldn't do
anything anyway ...". Well that was pre-Fedora 26 :)

It seems that dnf > 2.0 now intentionally throws an error when trying
to explicitly install an ignored package. Thus, as described in the
comment, take a simpler approach of skipping this on infra nodes.
pip-and-virtualenv in dib should have installed the latest pip,
virtualenv and setuptools, so we don't want to fiddle with that
anyway.

[1] https://review.openstack.org/#/c/338998/

Change-Id: Ib300b58377a0d0fe1bd7444c71acdb9a87dc033b

Ian Wienand authored on 2017/08/03 13:35:37
Showing 1 changed files
... ...
@@ -202,5 +202,22 @@ fi
202 202
 # on python-virtualenv), first install the distro python-virtualenv
203 203
 # to satisfy any dependencies then use pip to overwrite it.
204 204
 
205
-install_package python-virtualenv
206
-pip_install -U --force-reinstall virtualenv
205
+# ... but, for infra builds, the pip-and-virtualenv [1] element has
206
+# already done this to ensure the latest pip, virtualenv and
207
+# setuptools on the base image for all platforms.  It has also added
208
+# the packages to the yum/dnf ignore list to prevent them being
209
+# overwritten with old versions.  F26 and dnf 2.0 has changed
210
+# behaviour that means re-installing python-virtualenv fails [2].
211
+# Thus we do a quick check if we're in the infra environment by
212
+# looking for the mirror config script before doing this, and just
213
+# skip it if so.
214
+
215
+# [1] https://git.openstack.org/cgit/openstack/diskimage-builder/tree/ \
216
+#        diskimage_builder/elements/pip-and-virtualenv/ \
217
+#            install.d/pip-and-virtualenv-source-install/04-install-pip
218
+# [2] https://bugzilla.redhat.com/show_bug.cgi?id=1477823
219
+
220
+if [[ ! -f /etc/ci/mirror_info.sh ]]; then
221
+    install_package python-virtualenv
222
+    pip_install -U --force-reinstall virtualenv
223
+fi