- if ($saw_dumper and ($dumper_status eq 'success' or $dumper_status eq 'strange')) {
- push @rv, "full";
- push @rv, $hostname;
- push @rv, $disk_out;
- push @rv, $fmt_col_field->(2, $level);
- push @rv, $orig_size ? $fmt_col_field->(3, $self->tounits($orig_size)) : '';
- push @rv, $out_size ? $fmt_col_field->(4, $self->tounits($out_size)) : '';
- push @rv, ($compression == 100) ? '-- ' : $fmt_col_field->(5, $compression);
- push @rv, $dump_time ? $fmt_col_field->(6, mnsc($dump_time)) : "PARTIAL";
- push @rv, $dump_rate ? $fmt_col_field->(7, $dump_rate) : "";
- push @rv, $fmt_col_field->(8,
- (defined $tape_time) ?
- $tape_time ? mnsc($tape_time) : ""
- : "FAILED");
- push @rv, (defined $tape_rate) ?
- $tape_rate ?
- $fmt_col_field->(9, $tape_rate)
- : $format_space->(9, "")
- : $format_space->(9, "FAILED");
- push @rv, $taper_partial? " PARTIAL" : ""; # column 10
- } else {
- my $message = $saw_dumper?
- ($dumper_status eq 'failed') ? 'FAILED' : 'PARTIAL'
- : 'FLUSH';
- push @rv, "nodump-$message";
- push @rv, $hostname;
- push @rv, $disk_out;
- push @rv, $fmt_col_field->(2, $level);
- push @rv, $orig_size ? $fmt_col_field->(4, $self->tounits($orig_size)) :'';
- push @rv, $out_size ? $fmt_col_field->(4, $self->tounits($out_size)) : '';
- push @rv, ($compression == 100) ? '-- ' : $fmt_col_field->(5, $compression);
- push @rv, '';
- push @rv, '';
- push @rv, $fmt_col_field->(8,
- (defined $tape_time) ?
- $tape_time ? mnsc($tape_time) : ""
- : "FAILED");
- push @rv, (defined $tape_rate) ?
- $tape_rate ?
- $fmt_col_field->(9, $tape_rate)
- : $format_space->(9, "")
- : $format_space->(9, "FAILED");
- push @rv, $taper_partial? " PARTIAL" : "";
+ ## simple formatting macros
+
+ my $fmt_col_field = sub {
+ my ( $column, $data ) = @_;
+
+ return sprintf(
+ $col_spec->[$column]->[COLSPEC_FORMAT],
+ $col_spec->[$column]->[COLSPEC_WIDTH],
+ $col_spec->[$column]->[COLSPEC_PREC], $data
+ );
+ };
+
+ my $format_space = sub {
+ my ( $column, $data ) = @_;
+
+ return sprintf("%*s",$col_spec->[$column]->[COLSPEC_WIDTH], $data);
+ };
+
+ my @rv;
+
+ if ( !$orig_size && !$out_size && (!defined($tape_time) || !$tape_time)) {
+ push @rv, $report->get_flag("amflush_run")? 'noflush' : 'missing';
+ push @rv, $hostname;
+ push @rv, $disk_out;
+ push @rv, ("",) x 8;
+ } elsif ($saw_dumper and ($dumper_status eq 'success' or $dumper_status eq 'strange')) {
+ push @rv, "full";
+ push @rv, $hostname;
+ push @rv, $disk_out;
+ push @rv, $fmt_col_field->(2, $level);
+ push @rv, $orig_size ? $fmt_col_field->(3, $self->tounits($orig_size)) : '';
+ push @rv, $out_size ? $fmt_col_field->(4, $self->tounits($out_size)) : '';
+ push @rv, $compression;
+ push @rv, $dump_time ? $fmt_col_field->(6, mnsc($dump_time)) : "PARTIAL";
+ push @rv, $dump_rate ? $fmt_col_field->(7, $dump_rate) : "";
+ push @rv, $fmt_col_field->(8,
+ (defined $tape_time) ?
+ $tape_time ? mnsc($tape_time) : ""
+ : "FAILED");
+ push @rv, (defined $tape_rate) ?
+ $tape_rate ?
+ $fmt_col_field->(9, $tape_rate)
+ : $format_space->(9, "")
+ : $format_space->(9, "FAILED");
+ push @rv, $taper_partial? " PARTIAL" : ""; # column 10
+ } else {
+ my $message = $saw_dumper?
+ ($dumper_status eq 'failed') ? 'FAILED' : 'PARTIAL'
+ : 'FLUSH';
+ push @rv, "nodump-$message";
+ push @rv, $hostname;
+ push @rv, $disk_out;
+ push @rv, $fmt_col_field->(2, $level);
+ push @rv, $orig_size ? $fmt_col_field->(4, $self->tounits($orig_size)) :'';
+ push @rv, $out_size ? $fmt_col_field->(4, $self->tounits($out_size)) : '';
+ push @rv, $compression;
+ push @rv, '';
+ push @rv, '';
+ push @rv, $fmt_col_field->(8,
+ (defined $tape_time) ?
+ $tape_time ? mnsc($tape_time) : ""
+ : "FAILED");
+ push @rv, (defined $tape_rate) ?
+ $tape_rate ?
+ $fmt_col_field->(9, $tape_rate)
+ : $format_space->(9, "")
+ : $format_space->(9, "FAILED");
+ push @rv, $taper_partial? " PARTIAL" : "";
+ }
+ push @rvs, [@rv];