From 7113ae46171ddcbe6d195790b08acbb5c49dfd41 Mon Sep 17 00:00:00 2001 From: Bartosz Bezak <bartosz@stackhpc.com> Date: Fri, 14 Aug 2020 16:18:58 +0200 Subject: [PATCH] Make pip_index_url variable conditional Setting pip's proxy variable, operator needs to set also pip_index_url, even when one wants to use default value of index_url. This patch sets pip's index_url only when pip_index_url is not empty. Change-Id: If435e9025f3d78364b229bbe4458f5f1e1ab49aa --- ansible/roles/pip/tasks/pip_conf.yml | 3 +++ .../notes/pip-index-url-conditional-3f9c5b3c5c808500.yaml | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 releasenotes/notes/pip-index-url-conditional-3f9c5b3c5c808500.yaml diff --git a/ansible/roles/pip/tasks/pip_conf.yml b/ansible/roles/pip/tasks/pip_conf.yml index 2fef94f69..a9261e0b3 100644 --- a/ansible/roles/pip/tasks/pip_conf.yml +++ b/ansible/roles/pip/tasks/pip_conf.yml @@ -10,7 +10,9 @@ copy: content: | [global] + {% if pip_index_url | length > 0 -%} index-url = {{ pip_index_url }} + {% endif -%} {% if pip_trusted_hosts | length > 0 -%} trusted-host = {% for host in pip_trusted_hosts | unique -%} @@ -30,5 +32,6 @@ [easy_install] index-url = {{ pip_index_url }} dest: "~{{ user}}/.pydistutils.cfg" + when: pip_index_url | length > 0 become: True become_user: "{{ user }}" diff --git a/releasenotes/notes/pip-index-url-conditional-3f9c5b3c5c808500.yaml b/releasenotes/notes/pip-index-url-conditional-3f9c5b3c5c808500.yaml new file mode 100644 index 000000000..b995bd9d7 --- /dev/null +++ b/releasenotes/notes/pip-index-url-conditional-3f9c5b3c5c808500.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixes generation of pip configuration when using a pip proxy without + a local mirror.