return 0 if ($cfg_send == $SEND_AMREPORT_NEVER);
my $output_name = join(" ", @{ $output->[FORMAT] }, @{ $output->[OUTPUT] });
- my ($send_amreport, $process_stranges, $process_fails) = (0, 0, 0);
+ my $send_amreport = 0;
debug("testingamreport_send_on=$cfg_send, output:$output_name");
- foreach my $dle ($report->get_dles()) {
-
- my $dle_info = $report->get_dle_info(@$dle);
- my $tries = $dle_info->{tries};
-
- foreach my $try (@$tries) {
-
- foreach my $program (keys %$try) {
-
- $process_stranges++ if $try->{$program}{status} eq 'strange';
- $process_fails++ if $try->{$program}{status} eq 'fail';
- }
- }
- }
-
if ($cfg_send == $SEND_AMREPORT_STRANGE) {
if ( !$report->get_flag("got_finish")
- || ($report->get_flag("exit_status") != 0)
- || $process_stranges
- || $process_fails) {
+ || ($report->get_flag("dump_failed") != 0)
+ || ($report->get_flag("results_missing") != 0)
+ || ($report->get_flag("dump_strange") != 0)) {
- debug("send_amreport_on=$cfg_send, condition filled for $output_name");
+ debug("send-amreport-on=$cfg_send, condition filled for $output_name");
$send_amreport = 1;
} else {
- debug("send_amreport_on=$cfg_send, condition not filled for $output_name");
+ debug("send-amreport-on=$cfg_send, condition not filled for $output_name");
$send_amreport = 0;
}
if ( !$report->get_flag("got_finish")
|| ($report->get_flag("exit_status") != 0)
- || $process_fails) {
+ || ($report->get_flag("dump_failed") != 0)
+ || ($report->get_flag("results_missing") != 0)
+ || ($report->get_flag("dump_strange") != 0)) {
- debug("send_amreport_on=$cfg_send, condition filled for $output_name");
+ debug("send-amreport-on=$cfg_send, condition filled for $output_name");
$send_amreport = 1;
} else {
- debug("send_amreport_on=$cfg_send, condition not filled for $output_name");
+ debug("send-amreport-on=$cfg_send, condition not filled for $output_name");
$send_amreport = 0;
}
}
my $mailto = $outputspec->[1];
if ($mailto =~ /[*<>()\[\];:\\\/"!$|]/) {
- error("mail address has invalid characters", 1);
+ error("mail addresses have invalid characters", 1);
}
my $datestamp =
my $date = POSIX::strftime( '%B %e, %Y', 0, 0, 0, $day, $month, $year );
$date =~ s/ / /g;
- my $process_fails = 0;
-
- foreach my $dle ($report->get_dles()) {
- my $dle_info = $report->get_dle_info(@$dle);
- my $tries = $dle_info->{tries};
-
- foreach my $try (@$tries) {
- foreach my $program (keys %$try) {
- $process_fails++ if $try->{$program}{status} eq 'fail';
- }
- }
- }
-
my $done = "";
if ( !$report->get_flag("got_finish")
- || ($report->get_flag("exit_status") != 0)
- || $process_fails) {
+ || $report->get_flag("dump_failed") != 0) {
$done = " FAIL:";
+ } elsif ($report->get_flag("results_missing") != 0) {
+ $done = " MISSING:";
+ } elsif ($report->get_flag("dump_strange") != 0) {
+ $done = " STRANGE:";
}
my $subj_str =
getconf($CNF_ORG) . $done
- . ( $report->get_flag("amflush_run") ? " AMFLUSH" : " AMANDA" )
+ . ( $report->get_flag("amflush_run") ? " AMFLUSH" :
+ $report->get_flag("amvault_run") ? " AMVAULT" : " AMANDA" )
. " MAIL REPORT FOR "
. $date;
my $cfg_mailer = getconf($CNF_MAILER);
- my @cmd = ("$cfg_mailer", "-s", $subj_str, $mailto);
+ my @cmd = ("$cfg_mailer", "-s", $subj_str, split(/ +/, $mailto));
debug("invoking mail app: " . join(" ", @cmd));
($pid, $fh) = open_mail_output($report, $outputspec);
}
-
# TODO: add some generic error handling here. must be compatible
# with legacy behavior.
# TODO: modularize these better
if ($reportspec->[0] eq 'xml') {
- print $fh $report->xml_output();
+ print $fh $report->xml_output("" . getconf($CNF_ORG), $config_name);
} elsif ($reportspec->[0] eq 'human') {
my $hr =
Amanda::Report::human->new( $report, $fh, $config_name, $opt_logfname );
# read the tapelist
my $tl_file = config_dir_relative(getconf($CNF_TAPELIST));
-my $tl = Amanda::Tapelist::read_tapelist($tl_file);
+my $tl = Amanda::Tapelist->new($tl_file);
# read the disklist
my $diskfile = config_dir_relative(getconf($CNF_DISKFILE));
calculate_legacy_outputs();
}
-if (!@outputs) {
- print "no output specified, nothing to do\n";
- exit(0);
-}
-
## Parse the report & set output
$report = Amanda::Report->new($logfile, $historical);