aboutsummaryrefslogtreecommitdiff
path: root/lib/App/Glacier/Job/ArchiveRetrieval.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/Glacier/Job/ArchiveRetrieval.pm')
-rw-r--r--lib/App/Glacier/Job/ArchiveRetrieval.pm33
1 files changed, 29 insertions, 4 deletions
diff --git a/lib/App/Glacier/Job/ArchiveRetrieval.pm b/lib/App/Glacier/Job/ArchiveRetrieval.pm
index 660c4c9..dae6ac9 100644
--- a/lib/App/Glacier/Job/ArchiveRetrieval.pm
+++ b/lib/App/Glacier/Job/ArchiveRetrieval.pm
@@ -2,8 +2,8 @@ package App::Glacier::Job::ArchiveRetrieval;
use strict;
use warnings;
-require App::Glacier::Job;
use parent qw(App::Glacier::Job);
+use App::Glacier::Core;
use Carp;
# new(CMD, VAULT, ARCHIVE[, description => DESCR, OPTS...])
@@ -11,11 +11,36 @@ sub new {
croak "bad number of arguments" if $#_ < 3;
my ($class, $cmd, $vault, $archive, %opts) = @_;
my $descr = delete $opts{description};
- return $class->SUPER::new(
+ my $self = $class->SUPER::new(
$cmd,
$vault,
$vault . ':' . $archive,
- [ 'initiate_archive_retrieval', $vault, $archive, $descr ],
%opts
- );
+ );
+ $self->{_archive} = $archive;
+ $self->{_descr} = $descr;
+ return $self;
}
+
+sub init {
+ my $self = shift;
+ my $jid = $self->glacier->Initiate_archive_retrieval($self->vault,
+ $self->{_archive},
+ $self->{_descr});
+ if ($self->glacier->lasterr) {
+ if ($self->glacier->lasterr('code') == 404) {
+ $self->command->abend(EX_TEMPFAIL,
+ $self->glacier->last_error_message
+ . "\n"
+ . "Try again later or use the --cached option to see the cached content.")
+ } else {
+ $self->command->abend(EX_FAILURE,
+ "can't create job: ",
+ $self->command->lasterr('code'),
+ $self->command->last_error_message);
+ }
+ }
+ return $jid;
+}
+
+1;

Return to:

Send suggestions and report system problems to the System administrator.