Ignore:
Timestamp:
06/25/20 09:25:24 (4 years ago)
Author:
nanardon
Message:

Make la-rename continue even if rename failed in one base (or object is not found)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/bin/la-rename

    r891 r2416  
    5959$labase->wexported(1); 
    6060 
    61 my $obj = $labase->get_object($otype, $ARGV[0]) or do { 
    62     die "Object $otype $ARGV[0] not found\n"; 
    63 }; 
     61if ($labase->can('SetCB')) { 
     62    $labase->SetCB( sub { 
     63        my ( $base, $res ) = @_; 
     64        if ($res) { 
     65            print $base->label . ': Object renamed' . "\n"; 
     66            $base->commit; 
     67        } else { 
     68            warn $base->label . ': Cannot rename object' . "\n"; 
     69            $base->rollback; 
     70        } 
     71    } ); 
     72} 
    6473 
    6574if (!$labase->rename_object($otype, @ARGV)) { 
    66     die "Error while renaming $otype $ARGV[0] to $ARGV[1]\n"; 
     75    die "Some errors occurs, please check\n"; 
    6776} 
    6877 
    69 $labase->commit; 
Note: See TracChangeset for help on using the changeset viewer.