From 77bc616dc5e04a0e294a307e4154e7c1047694e8 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Wed, 27 Nov 2019 16:54:41 +0100 Subject: [PATCH] Add pypi_fqdn to differentiate it package mirrors There is mirror_fqdn that, if defined, overrides mirrors used for packages and also mirrors for pypi. This is generally incorrect, if one wants to use different mirrors for packages vs pypi eggs. Add pypi_fqdn that defaults to mirror_fqdn, which allows users to go with a custom pypi_mirror. Make pypi trusting the given pypi_fqdn value instead of generally unrelated mirror_fqdn. Change-Id: I12975b57951699351cfc0d40beaeb7c703651dd0 Signed-off-by: Bogdan Dobrelya --- roles/configure-mirrors/README.rst | 7 ++++++- roles/configure-mirrors/defaults/main.yaml | 3 ++- roles/configure-mirrors/templates/etc/pip.conf.j2 | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/configure-mirrors/README.rst b/roles/configure-mirrors/README.rst index 4359993b5..d7d6570d0 100644 --- a/roles/configure-mirrors/README.rst +++ b/roles/configure-mirrors/README.rst @@ -7,10 +7,15 @@ An ansible role to configure services to use mirrors. The base host for mirror servers. +.. zuul:rolevar:: pypi_fqdn + :default: {{ mirror_fqdn }} + + The base host for PyPi mirror server. + .. zuul:rolevar:: pypi_mirror URL to override the generated pypi mirror url based on - :zuul:rolevar:`configure-mirrors.mirror_fqdn`. + :zuul:rolevar:`configure-mirrors.pypi_fqdn`. .. zuul:rolevar:: set_apt_mirrors_trusted :default: False diff --git a/roles/configure-mirrors/defaults/main.yaml b/roles/configure-mirrors/defaults/main.yaml index fc2bd7ce5..4a07e2c90 100644 --- a/roles/configure-mirrors/defaults/main.yaml +++ b/roles/configure-mirrors/defaults/main.yaml @@ -1,4 +1,5 @@ mirror_fqdn: "{{ zuul_site_mirror_fqdn|default(omit) }}" -pypi_mirror: "http://{{ mirror_fqdn }}/pypi/simple" +pypi_fqdn: "{{ mirror_fqdn }}" +pypi_mirror: "http://{{ pypi_fqdn }}/pypi/simple" set_apt_mirrors_trusted: False wheel_mirror: "http://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}" diff --git a/roles/configure-mirrors/templates/etc/pip.conf.j2 b/roles/configure-mirrors/templates/etc/pip.conf.j2 index cd47f2810..7545be911 100644 --- a/roles/configure-mirrors/templates/etc/pip.conf.j2 +++ b/roles/configure-mirrors/templates/etc/pip.conf.j2 @@ -2,5 +2,5 @@ [global] timeout = 60 index-url = {{ pypi_mirror }} -trusted-host = {{ mirror_fqdn }} +trusted-host = {{ pypi_fqdn }} extra-index-url = {{ wheel_mirror }}