From 2b35e8158a9537f04ef3dbbd90ed13d19627a34c Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Fri, 20 Apr 2018 12:59:10 +0100 Subject: [PATCH] Disable the pip version check In our logs it is frequent that the warning to upgrade the pip version is present, but this warning is unnecessary as we are always using a well tested version of pip. To reduce noise, we set disable the version check. This has the added benefit of not adding more internet access to every pip task than is necessary. In the template we ensure that the var is interpreted as a boolean (in case of user error), then force it to lower case as that's what pip prefers in pip.conf. We also now remove the test for the self check file, as it will no longer be present with this option implemented. Change-Id: Ie0427d3435270836302441b92eaff7e7980d7047 (cherry picked from commit 70b8cd5737cdf2adfe69c0cea6859118c45ae878) --- defaults/main.yml | 1 + templates/pip.conf.j2 | 1 + tests/test.yml | 5 ----- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index ec22c24..e5cc4f1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -101,6 +101,7 @@ pip_validate_certs: "yes" pip_lock_to_internal_repo: False # Options for pip global +pip_disable_version_check: true pip_enable_pre_releases: true pip_timeout: 120 diff --git a/templates/pip.conf.j2 b/templates/pip.conf.j2 index 7cd93cd..71da566 100644 --- a/templates/pip.conf.j2 +++ b/templates/pip.conf.j2 @@ -1,6 +1,7 @@ # {{ ansible_managed }} [global] +disable-pip-version-check = {{ (pip_disable_version_check | bool) | lower }} pre = {{ (pip_enable_pre_releases | bool) | lower }} timeout = {{ pip_timeout }} {% if pip_lock_to_internal_repo and pip_links | length > 0 %} diff --git a/tests/test.yml b/tests/test.yml index 3405b5a..d4b4314 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -27,10 +27,6 @@ stat: path: "{{ ansible_env.HOME}}/.cache/pip" register: pip_dir - - name: Check selfcheck json file - stat: - path: "{{ ansible_env.HOME}}/.cache/pip/selfcheck.json" - register: pip_selfcheck_file - name: Get pip path command: which pip register: pip_path @@ -41,5 +37,4 @@ assert: that: - "pip_dir.stat.isdir" - - "pip_selfcheck_file.stat.exists" - "pip_version.stdout | search('8.0.3')"