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
This commit is contained in:
Bartosz Bezak 2020-08-14 16:18:58 +02:00 committed by Pierre Riteau
parent f40dde18df
commit 7113ae4617
2 changed files with 8 additions and 0 deletions

View File

@ -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 }}"

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes generation of pip configuration when using a pip proxy without
a local mirror.