aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mga-mirrors
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2021-02-25 22:45:56 +0000
committerPascal Terjan <pterjan@mageia.org>2021-02-25 22:45:56 +0000
commit69147cdcf7463249f62c0486a4db5720217e0768 (patch)
tree3f85484b49cf5c11941dd260b73a883e1e1d8c9f /modules/mga-mirrors
parent3fc75e4dbe4e3e17921df8a970618519ff2da5f3 (diff)
downloadpuppet-69147cdcf7463249f62c0486a4db5720217e0768.tar
puppet-69147cdcf7463249f62c0486a4db5720217e0768.tar.gz
puppet-69147cdcf7463249f62c0486a4db5720217e0768.tar.bz2
puppet-69147cdcf7463249f62c0486a4db5720217e0768.tar.xz
puppet-69147cdcf7463249f62c0486a4db5720217e0768.zip
Also check https only mirrors
The ones available both on http and https will be checked as https
Diffstat (limited to 'modules/mga-mirrors')
-rwxr-xr-xmodules/mga-mirrors/files/check_mirrors_status22
1 files changed, 18 insertions, 4 deletions
diff --git a/modules/mga-mirrors/files/check_mirrors_status b/modules/mga-mirrors/files/check_mirrors_status
index b31d4da5..c3d41354 100755
--- a/modules/mga-mirrors/files/check_mirrors_status
+++ b/modules/mga-mirrors/files/check_mirrors_status
@@ -33,18 +33,32 @@ def get_mirrors
# TODO Get it from the DB
mirrors = []
url = nil
+ tier1 = false
fetch_url("http://mirrors.mageia.org/").each_line{|l|
if l =~ /rsync.mageia.org/ then
- mirrors.prepend url unless url.nil?
+ tier1 = true
+ next
+ end
+ if l=~ /<\/tr>/ && !url.nil? then
+ if tier1 then
+ mirrors.prepend
+ tier1 = false
+ else
+ mirrors.append url
+ end
url = nil
next
end
- next unless l =~ /http:.*>http/
- mirrors.append url unless url.nil?
+ next unless l =~ /https?:.*>http/
+ # No need to check twice mirrors available in http + https
+ if !url.nil? && url =~ /https:/ && l =~ /https:\/\//
+ # Skip http:// if https:// already seen for current mirror
+ # If the are in the other order http one will just be replaced
+ next
+ end
url = l.sub(/<a href="(http[^"]*)".*\n/, '\1')
url += "/" unless url =~ /\/$/
}
- mirrors.append url unless url.nil?
mirrors
end