diff options
-rwxr-xr-x | generate-mirror-mail.pl | 12 |
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; } |