Skip to content

Commit

Permalink
* perl/Amanda/Extract.pm (BSU): Fix for non-application
Browse files Browse the repository at this point in the history
* perl/Amanda/FetchDump.pm: Add message 3300005
* perl/Amanda/FetchDump/Application.pm: Return a 3300005 message if it
  don't know how to extract the dump
* perl/Amanda/Restore.pm: Fix
* server-src/amfetchdump.pl: Check -O and --directory are not
  different


git-svn-id: https://svn.code.sf.net/p/amanda/code/amanda/trunk@6672 a8d146d6-cc15-0410-8900-af154a0219e0
  • Loading branch information
Jean-Louis Martineau committed May 5, 2016
1 parent 40dd84c commit ca70a37
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 7 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2016-05-05 Jean-Louis Martineau <JMartineau@carbonite.com>
* perl/Amanda/Extract.pm (BSU): Fix for non-application
* perl/Amanda/FetchDump.pm: Add message 3300005
* perl/Amanda/FetchDump/Application.pm: Return a 3300005 message if it
don't know how to extract the dump
* perl/Amanda/Restore.pm: Fix
* server-src/amfetchdump.pl: Check -O and --directory are not
different

2016-05-05 Jean-Louis Martineau <JMartineau@carbonite.com>
* device-src/s3.c: Fix AWS4 auth-string

Expand Down
4 changes: 1 addition & 3 deletions perl/Amanda/Extract.pm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ my %restore_programs = (
"GTAR" => [ $Amanda::Constants::GNUTAR, qw(--ignore-zeros -xf -) ],
"GNUTAR" => [ $Amanda::Constants::GNUTAR, qw(--ignore-zeros -xf -) ],
"SMBCLIENT" => [ $Amanda::Constants::GNUTAR, qw(-xf -) ],
"PKZIP" => undef,
);

my %validate_programs = (
Expand All @@ -112,7 +111,6 @@ my %validate_programs = (
"GTAR" => [ $Amanda::Constants::GNUTAR, qw(--ignore-zeros -tf -) ],
"GNUTAR" => [ $Amanda::Constants::GNUTAR, qw(--ignore-zeros -tf -) ],
"SMBCLIENT" => [ $Amanda::Constants::GNUTAR, qw(-tf -) ],
"PKZIP" => undef,
);

sub new {
Expand Down Expand Up @@ -180,7 +178,7 @@ sub BSU {
my $config = Amanda::Config::get_config_name();
my $program_path = $self->_set_program_path();

return undef if !$self->{'program_is_application'};
return ({}, []) if !$self->{'program_is_application'};
return $program_path if ref $program_path eq "HASH" && $program_path->isa('Amanda::Message');

my %bsu;
Expand Down
2 changes: 2 additions & 0 deletions perl/Amanda/FetchDump.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ sub local_message {
return "Reading label '$self->{'label'}' filenum $self->{'filenum'}\n$self->{'header_summary'}";
} elsif ($self->{'code'} == 3300004) {
return "Reading '$self->{'holding_file'}'\n$self->{'header_summary'}";
} elsif ($self->{'code'} == 3300005) {
return "Don't know how to extract the dump";
} elsif ($self->{'code'} == 3300057) {
return "Running a Fetchdump";
} elsif ($self->{'code'} == 3300058) {
Expand Down
11 changes: 9 additions & 2 deletions perl/Amanda/FetchDump/Application.pm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ sub set {
'exclude-list-glob' => $self->{'exclude-list-glob'});
die("$self->{'extract'}") if $self->{'extract'}->isa('Amanda::Message');
($self->{'bsu'}, my $err) = $self->{'extract'}->BSU();
if (@$err) {
if ($err && @$err) {
die("BSU err " . join("\n", @$err));
}

Expand Down Expand Up @@ -138,8 +138,15 @@ sub get_xfer_dest {

if ($self->{'use_directtcp'}) {
$self->{'xfer_dest'} = Amanda::Xfer::Dest::DirectTCPListen->new();
} else {
} elsif ($self->{'extract'}->{'restore_argv'}) {
$self->{'xfer_dest'} = Amanda::Xfer::Dest::Application->new($self->{'extract'}->{'restore_argv'}, 0, 0, 0, 1);
} else {
return Amanda::FetchDump::Message->new(
source_filename => __FILE__,
source_line => __LINE__,
code => 3300005,
severity => $Amanda::Message::ERROR);

}

return $self->{'xfer_dest'};
Expand Down
4 changes: 2 additions & 2 deletions perl/Amanda/Restore.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ debug("plan: " . Data::Dumper::Dumper($plan->{'dumps'}));
$self->{'feedback'}->run_pre_scripts();
}
$xfer_dest = $self->{'feedback'}->get_xfer_dest();
return $steps->{'failure'}->($xfer_dest) if ref $xfer_dest eq "HASH" && $xfer_dest->isa('Amanda::Message');
return $steps->{'failure'}->($xfer_dest) if $xfer_dest->isa('Amanda::Message');
if ($self->{'feedback'}->can('new_dest_fh')) {
if (my $new_dest_fh = $self->{'feedback'}->new_dest_fh()) {
return $steps->{'failure'}->($new_dest_fh) if ref $new_dest_fh eq "HASH" && $new_dest_fh->isa('Amanda::Message');
Expand All @@ -1667,7 +1667,7 @@ debug("plan: " . Data::Dumper::Dumper($plan->{'dumps'}));
$self->{'feedback'}->run_pre_scripts();
}
$xfer_dest = $self->{'feedback'}->get_xfer_dest();
return $steps->{'failure'}->($xfer_dest) if ref $xfer_dest eq "HASH" && $xfer_dest->isa('Amanda::Message');
return $steps->{'failure'}->($xfer_dest) if $xfer_dest->isa('Amanda::Message');
} elsif ($params{'pipe-fd'}) {
if ($directtcp_supported) {
$xfer_dest = Amanda::Xfer::Dest::DirectTCPListen->new();
Expand Down
11 changes: 11 additions & 0 deletions server-src/amfetchdump.pl
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,17 @@ sub usage {
usage();
}

if (defined $opt_chdir && defined $opt_directory) {
if ($opt_chdir ne $opt_directory) {
print STDERR("-O and --directory must be the same");
exit 1;
}
} elsif (defined $opt_chdir) {
$opt_directory = $opt_chdir;
} elsif (defined $opt_directory) {
$opt_chdir = $opt_directory;
}

#$decompress = $ALWAYS;
#$decrypt = $ALWAYS;
#$decrypt = $NEVER if defined $opt_leave;
Expand Down

0 comments on commit ca70a37

Please sign in to comment.