summaryrefslogtreecommitdiffstats
path: root/generate-mirror-mail.pl
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-05-09 19:43:19 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-05-09 19:43:19 +0200
commitc31038c78c5483ea8f64f68f729654bfc9a3bf54 (patch)
tree8c298434626a412b309f08070e0adbef282f4258 /generate-mirror-mail.pl
parent2541ade3f2841f9215e32a1513079e02a1d7a1b9 (diff)
downloadbin-c31038c78c5483ea8f64f68f729654bfc9a3bf54.tar.gz
bin-c31038c78c5483ea8f64f68f729654bfc9a3bf54.tar.xz
generate-mirror-mail.pl: Support single protocol fails
This doesn't affect out of sync messages so it's only supported for connection fails. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'generate-mirror-mail.pl')
-rwxr-xr-xgenerate-mirror-mail.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/generate-mirror-mail.pl b/generate-mirror-mail.pl
index 765ae63..e0b98b1 100755
--- a/generate-mirror-mail.pl
+++ b/generate-mirror-mail.pl
@@ -27,10 +27,10 @@ Florian
',
},
'connection-failed' => {
- 'subject' => '[{$mirror_name}] Arch Linux mirror not accessible',
+ 'subject' => '[{$mirror_name}] Arch Linux mirror not accessible{$OUT = ", ".join("/", @affected_protocols) if @affected_protocols > 0;}',
'template' => 'Hi,
-We\'re having trouble connecting to your mirror, could you
+We\'re having trouble connecting to your mirror{$OUT = " via ".join(", ", @affected_protocols) if @affected_protocols > 0;}, could you
please check what\'s going on?
{$mirror_urls}
@@ -102,6 +102,7 @@ while (<>) {
push @connection_failed, {
url => $mirror->{url},
details_link => "", # TODO
+ protocol => $mirror->{protocol},
};
}
}
@@ -124,11 +125,16 @@ while (<>) {
}
if (@connection_failed) {
-
my %values = (
mirror_urls => join("\n", $url, map {${$_}{details_link}} @connection_failed),
mirror_name => $mirror_name,
);
+
+ my @protocols = map {${$_}{protocol}} @connection_failed;
+ if (scalar(@protocols) != scalar(@{$json->{urls}})) {
+ $values{affected_protocols} = \@protocols;
+ }
+
send_template_mail($to, $templates{"connection-failed"}{"subject"}, $templates{"connection-failed"}{"template"}, \%values);
$sent_mail = 1;
}