diff --git a/roles/inframail/templates/ring-aptsummary b/roles/inframail/templates/ring-aptsummary index 4a25284a4..b8d4be16d 100755 --- a/roles/inframail/templates/ring-aptsummary +++ b/roles/inframail/templates/ring-aptsummary @@ -45,20 +45,17 @@ sub process_file { my $host; foreach my $line (@lines) { - if ($line =~ m/^Subject:\s+(\[reboot required\])?\s*unattended-upgrades result for (.+)/) { - $host = $2; - } - if ($line =~ m/^Unattended upgrade returned: (.+)/) { - return unless ($host); - $upgrade_result{$host} = $1; - if ($upgrade_result{$host} ne 'True') { + if ($line =~ m/^Subject:\s+.*unattended-upgrades result for (.+):\s(.+)/) { + $host = $1; + $upgrade_result{$host} = $2; + if ($upgrade_result{$host} ne 'SUCCESS') { $sendmail = 1; $mail_log{$host} = \@lines; } } if ($line =~ m/^Warning: A reboot is required/) { return unless ($host); - if ($upgrade_result{$host} eq 'True') { + if ($upgrade_result{$host} eq 'SUCCESS') { $upgrade_result{$host} = 'Reboot'; } } @@ -77,7 +74,7 @@ sub send_mail { } $body .= "Succeeded:\n"; foreach my $host (sort keys %upgrade_result) { - if ($upgrade_result{$host} eq 'True') { + if ($upgrade_result{$host} eq 'SUCCESS') { $body .= "\t$host\n"; } elsif ($upgrade_result{$host} eq 'Reboot') { $body .= "\t$host (R)\n";