aboutsummaryrefslogtreecommitdiff
path: root/lib/App/Glacier/Command.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/Glacier/Command.pm')
-rw-r--r--lib/App/Glacier/Command.pm43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/App/Glacier/Command.pm b/lib/App/Glacier/Command.pm
index 7178a75..1f9a130 100644
--- a/lib/App/Glacier/Command.pm
+++ b/lib/App/Glacier/Command.pm
@@ -162,6 +162,14 @@ sub clone {
162 $self 162 $self
163} 163}
164 164
165sub option {
166 my ($self, $opt, $val) = @_;
167 if (defined($val)) {
168 $self->{_options}{$opt} = $val;
169 }
170 return $self->{_options}{$opt};
171}
172
165sub touchdir { 173sub touchdir {
166 my ($self, $dir) = @_; 174 my ($self, $dir) = @_;
167 unless (-d $dir) { 175 unless (-d $dir) {
@@ -276,4 +284,39 @@ sub archive_cache_filename {
276 $archive_id); 284 $archive_id);
277} 285}
278 286
287sub check_job {
288 my ($self, $key, $descr, $vault) = @_;
289
290 $self->debug(2, "$descr->{JobId} $descr->{Action} $vault");
291 if ($descr->{StatusCode} eq 'Failed') {
292 $self->debug(1,
293 "deleting failed $key $vault "
294 . ($descr->{JobDescription} || $descr->{Action})
295 . ' '
296 . $descr->{JobId});
297 $self->jobdb()->delete($key) unless $self->dry_run;
298 return;
299 }
300
301 my $res = $self->glacier->Describe_job($vault, $descr->{JobId});
302 if ($self->glacier->lasterr) {
303 if ($self->glacier->lasterr('code') == 404) {
304 $self->debug(1,
305 "deleting expired $key $vault "
306 . ($descr->{JobDescription} || $descr->{Action})
307 . ' '
308 . $descr->{JobId});
309 App::Glacier::Job->fromdb($self, $vault, $key, $res)->delete()
310 unless $self->dry_run;
311 } else {
312 $self->error("can't describe job $descr->{JobId}: ",
313 $self->glacier->last_error_message);
314 }
315 return;
316 } elsif (ref($res) ne 'HASH') {
317 croak "describe_job returned wrong datatype (".ref($res).") for \"$descr->{JobId}\"";
318 }
319 return $res;
320}
321
2791; 3221;

Return to:

Send suggestions and report system problems to the System administrator.