From 5d7a2ff88de4a87b630b6bf3b1236920f0233c76 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Thu, 18 May 2023 23:23:43 -0300 Subject: [PATCH] tests/e2e: downgrade requests package if needed The distro might have requests < 2.29.0 already so that the package doesn't need to be downgraded. Actually an attempt to downgrade it fail the playbook. Fixes #206 Signed-off-by: Wainer dos Santos Moschetta --- tests/e2e/ansible/start_docker_registry.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/e2e/ansible/start_docker_registry.yml b/tests/e2e/ansible/start_docker_registry.yml index 254f8e1c..a8eead8e 100644 --- a/tests/e2e/ansible/start_docker_registry.yml +++ b/tests/e2e/ansible/start_docker_registry.yml @@ -24,9 +24,12 @@ # Due to a bug in requests 2.29.0 we need to downgrade it # see https://github.com/docker/docker-py/issues/3113 - name: Downgrade requests - pip: - name: requests - version: 2.28.1 + shell: | + actual_version="$(pip3 show requests | grep Version | cut -d: -f2 | xargs)" + version_ge="$(echo -e "2.29.0\n$actual_version" | sort -V | head -1)" + if [ "$version_ge" = "2.29.0" ]; then + pip3 install requests==2.28.1 + fi - name: Start a docker registry docker_container: name: "{{ local_registry_name }}"