summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2019-01-06 11:23:14 +0100
committerFlorian Pritz <bluewind@xinu.at>2019-01-06 11:23:14 +0100
commita90d0409eb21c3feb6d599e56b160c12cba3f376 (patch)
tree9068667e5e87f7a80fb34775f259186863a57d3b
parent1c1f5442f9c10482479596c202522994a523c75a (diff)
downloadarch-mirror-tools-a90d0409eb21c3feb6d599e56b160c12cba3f376.tar.gz
arch-mirror-tools-a90d0409eb21c3feb6d599e56b160c12cba3f376.tar.xz
Use hash to track connection failed mirrors
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xbin/generate-mirror-mail.pl11
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/generate-mirror-mail.pl b/bin/generate-mirror-mail.pl
index 353c7b0..f73656f 100755
--- a/bin/generate-mirror-mail.pl
+++ b/bin/generate-mirror-mail.pl
@@ -157,7 +157,6 @@ while (<STDIN>) {
}
my $issues;
- my @connection_failed;
for my $mirror (@{$json->{urls}}) {
next if not $mirror->{active};
@@ -172,7 +171,7 @@ while (<STDIN>) {
}
} else {
#if ($mirror->{last_sync} and $mirror->{completion_pct} < 0.9 and $mirror->{completion_pct} > 0) {
- push @connection_failed, {
+ push @{$issues->{connection_failed}}, {
url => $mirror->{url},
details_link => $mirror->{details},
protocol => $mirror->{protocol},
@@ -193,27 +192,27 @@ while (<STDIN>) {
mirror_urls => join("\n", map {${$_}{details_link}} @{$issues->{out_of_sync}}),
},
connection_failed => {
- mirror_urls => join("\n", map {${$_}{details_link}} @connection_failed),
+ mirror_urls => join("\n", map {${$_}{details_link}} @{$issues->{connection_failed}}),
},
mirror_name => $mirror_name,
mirror_url => $url,
mail_from_name => $Config->{misc}->{name} // die "misc.name not set in config",
);
- my @protocols = uniq map {${$_}{protocol}} @connection_failed;
+ my @protocols = uniq map {${$_}{protocol}} @{$issues->{connection_failed}};
my @active_urls = grep { $_->{active} } @{$json->{urls}};
if (scalar(@protocols) != scalar(@active_urls)) {
$values{connection_failed}->{protocols} = \@protocols;
}
- if (@{$issues->{out_of_sync}} and @connection_failed) {
+ if (@{$issues->{out_of_sync}} and @{$issues->{connection_failed}}) {
send_template_mail($to, $templates{"multiple-issues"}{"subject"}, $templates{"multiple-issues"}{"template"}, \%values);
$sent_mail = 1;
} elsif (@{$issues->{out_of_sync}}) {
send_template_mail($to, $templates{"out-of-sync"}{"subject"}, $templates{"out-of-sync"}{"template"}, \%values);
$sent_mail = 1;
- } elsif (@connection_failed) {
+ } elsif (@{$issues->{connection_failed}}) {
send_template_mail($to, $templates{"connection-failed"}{"subject"}, $templates{"connection-failed"}{"template"}, \%values);
$sent_mail = 1;
}