]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
bootstrap: If ansible<2.10 is present, remove it
authorZack Cerza <zack@redhat.com>
Wed, 13 Apr 2022 22:36:45 +0000 (16:36 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 26 Apr 2022 16:32:00 +0000 (16:32 +0000)
... before proceeding. This is because in 2.10, ansible split into two
packages, a scenario that pip apparently isn't able to handle properly.

Signed-off-by: Zack Cerza <zack@redhat.com>
bootstrap

index 968b91e02b44c74487d79482962ec3680140a13c..997882df4bd2aa870e8371fb96db5cba1d0e2101 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -150,6 +150,16 @@ if [ -z "$NO_CLOBBER" ] || [ ! -e ./$VENV ]; then
     virtualenv --python=$PYTHON $VENV
 fi
 
+# It is impossible to upgrade ansible from 2.9 to 2.10 via pip.
+# See https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.10.html#known-issues
+if [ -f "$VENV/bin/ansible" ]; then
+    ansible_version=$($VENV/bin/pip list --format json | python3 -c "import sys; import json; print(list(filter(lambda i: i['name'] == 'ansible', json.loads(sys.stdin.read())))[0]['version'])")
+    uninstall_ansible=$(python3 -c "from packaging.version import parse; print(parse('$ansible_version') < parse('2.10.0'))")
+    if [ "$uninstall_ansible" = "True" ]; then
+        ./$VENV/bin/pip uninstall -y ansible
+    fi
+fi
+
 # First, upgrade pip
 ./$VENV/bin/pip install --upgrade pip