Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let mirrors specify multiple countries #268

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions mirrormanager2/lib/mirrorlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,27 @@ def setup_category_topdir_cache(session):
category_topdir_cache[category_id]:]
del repos

countries = []
if country is not None:
country = country.upper()
countries = country.split(u',')

if not siteprivate and not hostprivate:
add_host_to_set(cache[directoryname]['global'], hostid)

if country is not None:
for country in countries:
if country not in cache[directoryname]['byCountry']:
cache[directoryname]['byCountry'][country] = set()
add_host_to_set(
cache[directoryname]['byCountry'][country], hostid)

if country is not None and i2 and \
for country in countries:
if i2 and \
((not siteprivate and not hostprivate) or i2_clients):
if country not in cache[directoryname]['byCountryInternet2']:
cache[directoryname]['byCountryInternet2'][country] = set()
add_host_to_set(
cache[directoryname]['byCountryInternet2'][country], hostid)
if country not in cache[directoryname]['byCountryInternet2']:
cache[directoryname]['byCountryInternet2'][country] = set()
add_host_to_set(
cache[directoryname]['byCountryInternet2'][country], hostid)

append_value_to_cache(cache[directoryname]['byHostId'], hostid, hcurl)

Expand Down Expand Up @@ -254,7 +257,11 @@ def populate_host_bandwidth_cache(cache, host):


def populate_host_country_cache(cache, host):
cache[host.id] = host.country
if u',' in host.country:
country = host.country.split(u',')[0]
else:
country = host.country
cache[host.id] = country.strip()
return cache


Expand Down