From c31038c78c5483ea8f64f68f729654bfc9a3bf54 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 9 May 2016 19:43:19 +0200 Subject: 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 --- generate-mirror-mail.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'generate-mirror-mail.pl') 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; } -- cgit v1.2.3-24-g4f1b