From c7e772c164c0c08be90624d76d4c3e11864364b7 Mon Sep 17 00:00:00 2001 From: Attila Fazekas Date: Tue, 1 Sep 2015 15:18:57 +0200 Subject: [PATCH] Use the pip installed version of requests with Fedora The upstream version of requests contains a copy of urllib3 and cardet library, common practice in many distros to create symbolic links for these libraries instead of creating a huge package which contains the same library as the distro provides as separate package as well. Now devstack upgrades the urllib3 to incompatible version, but it leaves the requests unchanged because Fedora already has the latest version. The issue does not happens with Ubuntu because it has older requests and devstack updates it as well. The pip installed version contains a bundled urllib3 and the actually installed urllib3 version does not matters. This is not the `usual` distro package overrides pip installed package case. Change-Id: Icfa71368384b0c2e3ff39265b2fa9190b5566b9b Related-Bug: #1476770 --- tools/fixup_stuff.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/fixup_stuff.sh b/tools/fixup_stuff.sh index 4fff57f401..a601cf2f67 100755 --- a/tools/fixup_stuff.sh +++ b/tools/fixup_stuff.sh @@ -134,6 +134,31 @@ if is_fedora; then sudo systemctl start iptables fi fi + + if [[ "$os_RELEASE" -ge "21" ]]; then + # requests ships vendored version of chardet/urllib3, but on + # fedora these are symlinked back to the primary versions to + # avoid duplication of code on disk. This is fine when + # maintainers keep things in sync, but since devstack takes + # over and installs later versions via pip we can end up with + # incompatible versions. + # + # The rpm package is not removed to preserve the dependent + # packages like cloud-init; rather we remove the symlinks and + # force a re-install of requests so the vendored versions it + # wants are present. + # + # Realted issues: + # https://bugs.launchpad.net/glance/+bug/1476770 + # https://bugzilla.redhat.com/show_bug.cgi?id=1253823 + + base_path=/usr/lib/python2.7/site-packages/requests/packages + if [ -L $base_path/chardet -o -L $base_path/urllib3 ]; then + sudo rm -f /usr/lib/python2.7/site-packages/requests/packages/{chardet,urllib3} + # install requests with the bundled urllib3 to avoid conflicts + pip_install --upgrade --force-reinstall requests + fi + fi fi # The version of pip(1.5.4) supported by python-virtualenv(1.11.4) has