aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2017-04-12 11:07:34 +0100
committerPascal Terjan <pterjan@mageia.org>2017-04-12 11:07:34 +0100
commit1e9c035317d65a98b2f896d5bd87e44fe020f48a (patch)
treeaf6ef375370ac75f9b58322ceca6cb58fe6f39d0
parent42c4dd62337069e0f2c636770e201e361d864a2c (diff)
downloadpuppet-1e9c035317d65a98b2f896d5bd87e44fe020f48a.tar
puppet-1e9c035317d65a98b2f896d5bd87e44fe020f48a.tar.gz
puppet-1e9c035317d65a98b2f896d5bd87e44fe020f48a.tar.bz2
puppet-1e9c035317d65a98b2f896d5bd87e44fe020f48a.tar.xz
puppet-1e9c035317d65a98b2f896d5bd87e44fe020f48a.zip
Fix check_mirrors_status broken by previous commit
-rwxr-xr-xmodules/mga-mirrors/files/check_mirrors_status42
1 files changed, 16 insertions, 26 deletions
diff --git a/modules/mga-mirrors/files/check_mirrors_status b/modules/mga-mirrors/files/check_mirrors_status
index e6406c17..1d5d60af 100755
--- a/modules/mga-mirrors/files/check_mirrors_status
+++ b/modules/mga-mirrors/files/check_mirrors_status
@@ -6,12 +6,11 @@ require 'optparse'
require 'thread'
require 'uri'
-def get_dates(base, distros, archs, optional=true)
+def get_dates(base, archs_per_distro, optional=true)
r = {}
- distros.each{|d|
+ archs_per_distro.each{|d, archs|
r[d] = {}
archs.each{|a|
- next if d == '5' and a =~ /arm/
begin
r[d][a] = get_date(base, d, a)
rescue Timeout::Error, ArgumentError, NoMethodError, Errno::EHOSTUNREACH => e
@@ -73,7 +72,7 @@ def get_date(url, distrib, arch)
return parse_version(fetch_url("#{url}/distrib/#{distrib}/#{arch}/VERSION"))
end
-def print_output(distros, archs, mirrors, ref_times, times)
+def print_output(archs_per_distro, mirrors, ref_times, times)
puts "<html>
<style>
td.broken {background-color:#FF0033;}
@@ -93,26 +92,24 @@ th {background-color:#EEEEEE;}
puts "<table cellpadding='4px'><tr><td class='ok'>Up to date</td><td class='almost'>Less than 12h old</td><td class='bad'>Less than 2 days old</td><td class='broken'>Old or broken</td></tr></table>"
puts "<table><thead>"
puts "<tr><td/>"
- distros.each{|d|
+ archs_per_distro.each{|d, archs|
nb_arches = archs.size
- nb_arches -= 1 if d == '5' # 'armv5tl'
- puts " <td/><th colspan='#{nb_arches}'>#{d}</th>"}
+ puts " <td/><th colspan='#{nb_arches}'>#{d}</th>"
+ }
puts "</tr>"
puts "<tr><td/>"
- distros.each{|d|
+ archs_per_distro.each{|d, archs|
puts " <td class='sep' />"
archs.each{|a|
- next if d == '5' and a == 'armv5tl'
puts " <th>#{a}</th>"
}
}
puts "</tr></thead>"
puts "<tbody>"
puts "<tr><td class='name'>Reference</td>"
- distros.each{|d|
+ archs_per_distro.each{|d, archs|
puts " <td class='sep' />"
archs.each{|a|
- next if d == '5' and a == 'armv5tl'
puts " <td>#{ref_times[d][a].strftime("%F %R")}</td>"
}
}
@@ -120,10 +117,9 @@ th {background-color:#EEEEEE;}
mirrors.each{|u|
puts "<tr><td class='name'><a href='#{u}'>#{u}</a></td>"
- distros.each{|d|
+ archs_per_distro.each{|d, archs|
puts " <td class='sep' />"
archs.each{|a|
- next if d == '5' and a == 'armv5tl'
if times[u][d][a] != nil then
cls = 'broken'
diff = ref_times[d][a] - times[u][d][a]
@@ -154,8 +150,10 @@ end
# Defaults
ref = 'http://repository.mageia.org/'
-distros = ['5', 'cauldron']
-archs = ['i586', 'x86_64', 'armv5tl', 'armv7hl']
+archs_per_distro = {
+ '5' => ['i586', 'x86_64'],
+ 'cauldron' => ['i586', 'x86_64', 'armv5tl', 'armv7hl']
+}
parallel = 8
OptionParser.new {|opts|
@@ -164,14 +162,6 @@ OptionParser.new {|opts|
"Reference repository. Default: #{ref}") {
|url| ref = url
}
- opts.on("--distros x,y,z", Array,
- "List of distributions to check. Default: #{distros}") {
- |list| distros = list
- }
- opts.on("--archs x,y,z", Array,
- "List of architectures to check. Default: #{archs}") {
- |list| archs = list
- }
opts.on("--parallel n", Integer,
"Max number of parallel connections. Default: #{parallel}") {
|n| $parallel = n
@@ -184,7 +174,7 @@ OptionParser.new {|opts|
# Get dates from the reference repository, and fail if some requested distros
# or archs are missing
-ref_times = get_dates(ref, distros, archs, false)
+ref_times = get_dates(ref, archs_per_distro, false)
# Get the list of mirror URLs to check
mirrors = get_mirrors
@@ -198,7 +188,7 @@ threads = (1..parallel).map{|n|
loop do
u = workqueue.pop
break if u == :exit
- times[u] = get_dates(u, distros, archs)
+ times[u] = get_dates(u, archs_per_distro)
end
}
}
@@ -219,5 +209,5 @@ threads.each{|t|
}
# Generate output
-print_output(distros, archs, mirrors, ref_times, times)
+print_output(archs_per_distro, mirrors, ref_times, times)