Re: lexical.pm last_use_label ignores "storage" field on tapelist

Nathan Stratton Treadway <[email protected]> Thu, 26 Apr 2018 22:15:21 -0400
Newsgroups gmane.comp.archivers.amanda.devel
Message-ID <[email protected]>
On Mon, Mar 12, 2018 at 14:49:02 +0000, Jean-Louis Martineau wrote:
> Nathan,
> 
> try this patch.
> 
> Jean-Louis

Jean-Louis, 

It appears that this patch hasn't been pushed to the git repo -- should
it have been?

Thanks.

								Nathan



> diff --git a/perl/Amanda/Taper/Scan/lexical.pm b/perl/Amanda/Taper/Scan/lexical.pm
> index 030f8fd..53e8413 100644
> --- a/perl/Amanda/Taper/Scan/lexical.pm
> +++ b/perl/Amanda/Taper/Scan/lexical.pm
> @@ -78,6 +78,22 @@ sub last_use_label {
>      my $label = $tles->[0]->{'label'};
>  }
>  
> +sub last_use_label_from_pool {
> +    my $self = shift;
> +
> +    my $tles = $self->{'tapelist'}->{tles};
> +    my $count = @{$tles};
> +    for (my $i = 0; $i < $count ; $i++) {
> +	my $tle = $tles->[$i];
> +	if ($tle->{'datestamp'} != '0' &&
> +	    (!defined $tle->{'pool'} ||
> +	      $tle->{'pool'} eq $self->{'tapepool'})) {
> +	    return $tle->{'label'};
> +	}
> +    }
> +    return undef;
> +}
> +
>  sub analyze {
>      my $self = shift;
>      my $inventory  = shift;
> @@ -93,7 +109,7 @@ sub analyze {
>      my @unknown;
>      my @error;
>  
> -    my $last_label = $self->last_use_label();
> +    my $last_label = $self->last_use_label_from_pool();
>  
>      for my $i (0..(scalar(@$inventory)-1)) {
>  	my $sl = $inventory->[$i];



----------------------------------------------------------------------------
Nathan Stratton Treadway  -  [email protected]  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239