Changeset 128

Show
Ignore:
Timestamp:
04/20/10 20:22:36 (4 years ago)
Author:
depesz
Message:

1. add handling for --rsync-path option
2. add --debug "option"

it's "option", and not option, because it has to be first argument, and it's not documented, as its of *no* use to anybody using omnipitr in normal circumstances.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/omnipitr/doc/omnipitr-archive.pod

    r118 r128  
    9090variable. 
    9191 
     92=item --rsync-path (-rp) 
     93 
     94Full path to rsync program - in case you can't set proper PATH environment 
     95variable. 
     96 
    9297=back 
    9398 
  • trunk/omnipitr/lib/OmniPITR/Program.pm

    r117 r128  
    2222    my $class = shift; 
    2323    my $self = bless {}, $class; 
     24    $self->check_debug(); 
    2425    $self->read_args(); 
    2526    $self->validate_args(); 
     
    2728 
    2829    return $self; 
     30} 
     31 
     32=head1 check_debug() 
     33 
     34Internal method providing --debug option handling to every omnipitr program. 
     35 
     36If *first* argument to omnipitr program it will print to stderr all arguments, and environment variables. 
     37 
     38=cut 
     39 
     40sub check_debug { 
     41    my $self = shift; 
     42    return unless '--debug' eq $ARGV[ 0 ]; 
     43 
     44    warn "DEBUG INFORMATION:\n"; 
     45    for my $key ( sort keys %ENV ) { 
     46        warn sprintf( "ENV: '%s' => '%s'\n", $key, $ENV{ $key } ); 
     47    } 
     48    warn "Command line arguments: [" . join( "] , [", @ARGV ) . "]\n"; 
     49    shift @ARGV; 
     50 
     51    return; 
    2952} 
    3053 
  • trunk/omnipitr/lib/OmniPITR/Program/Archive.pm

    r124 r128  
    6868 
    6969            $self->log->time_start( $comment ) if $self->verbose; 
    70             my $response = run_command( $self->{ 'temp-dir' }, 'rsync', $local_file, $destination_file_path ); 
     70            my $response = run_command( $self->{ 'temp-dir' }, $self->{ 'rsync-path' }, $local_file, $destination_file_path ); 
    7171            $self->log->time_finish( $comment ) if $self->verbose; 
    7272 
     
    290290        'bzip2-path' => 'bzip2', 
    291291        'lzma-path'  => 'lzma', 
     292        'rsync-path' => 'rsync', 
    292293    ); 
    293294 
     
    304305        'log|l=s', 
    305306        'lzma-path|lp=s', 
     307        'rsync-path|rp=s', 
    306308        'pid-file=s', 
    307309        'state-dir|s=s', 
     
    313315    $args{ 'log' } =~ tr/^/%/; 
    314316 
    315     for my $key ( qw( data-dir dst-backup temp-dir state-dir pid-file verbose gzip-path bzip2-path lzma-path force-data-dir ) ) { 
     317    for my $key ( qw( data-dir dst-backup temp-dir state-dir pid-file verbose gzip-path bzip2-path lzma-path force-data-dir rsync-path ) ) { 
    316318        $self->{ $key } = $args{ $key }; 
    317319    } 
     
    378380                { 
    379381                'compression' => 'none', 
    380                 'path'        => $self->{ 'dst-backup'}
     382                'path'        => $self->{ 'dst-backup' }
    381383                }; 
    382384        } 
     
    393395    } 
    394396 
    395     $self->log->fatal( 'Given segment name is not valid (%s)', $self->{ 'segment' } ) unless basename( $self->{ 'segment' } ) =~ m{\A(?:[a-fA-F0-9]{24}(?:\.[a-fA-F0-9]{8}\.backup)?|[a-fA-F0-9]{8}\.history)\z}; 
     397    $self->log->fatal( 'Given segment name is not valid (%s)', $self->{ 'segment' } ) 
     398        unless basename( $self->{ 'segment' } ) =~ m{\A(?:[a-fA-F0-9]{24}(?:\.[a-fA-F0-9]{8}\.backup)?|[a-fA-F0-9]{8}\.history)\z}; 
    396399    my $segment_file_name = $self->{ 'segment' }; 
    397400    $segment_file_name = File::Spec->catfile( $self->{ 'data-dir' }, $self->{ 'segment' } ) unless $self->{ 'segment' } =~ m{^/};