diff options
-rw-r--r-- | lib/App/Glacier/Bre.pm | 4 | ||||
-rw-r--r-- | lib/App/Glacier/Command/Jobs.pm | 4 | ||||
-rw-r--r-- | lib/App/Glacier/Command/Periodic.pm | 23 |
3 files changed, 19 insertions, 12 deletions
diff --git a/lib/App/Glacier/Bre.pm b/lib/App/Glacier/Bre.pm index 3b1d190..cd9fb84 100644 --- a/lib/App/Glacier/Bre.pm +++ b/lib/App/Glacier/Bre.pm @@ -26,8 +26,8 @@ sub new { if ($token) { # Overwrite the 'sig' attribute. # FIXME: The attribute itself is not documented, so this - # this method may fail if the internals of the base class - # change in its future releases. + # method may fail if the internals of the base class change + # in its future releases. # This approach works with Net::Amazon::Glacier 0.15 $self->{sig} = new App::Glacier::Signature($self->{sig}, $token); } diff --git a/lib/App/Glacier/Command/Jobs.pm b/lib/App/Glacier/Command/Jobs.pm index 736d713..5a5f488 100644 --- a/lib/App/Glacier/Command/Jobs.pm +++ b/lib/App/Glacier/Command/Jobs.pm @@ -6,6 +6,7 @@ use parent qw(App::Glacier::Command); use Carp; use Data::Dumper; use App::Glacier::Timestamp; +use App::Glacier::Job; =head1 NAME @@ -136,7 +137,8 @@ sub list { $self->debug(1, "deleting expired $key $vault " . ($descr->{JobDescription} || $descr->{Action}) . $descr->{JobId}); - $db->delete($key) unless $self->dry_run; + App::Glacier::Job->fromdb($self, $vault, $key, $res)->delete() + unless $self->dry_run; return; } else { $self->error("can't describe job $descr->{JobId}: ", diff --git a/lib/App/Glacier/Command/Periodic.pm b/lib/App/Glacier/Command/Periodic.pm index 51c9718..5a4dc2a 100644 --- a/lib/App/Glacier/Command/Periodic.pm +++ b/lib/App/Glacier/Command/Periodic.pm @@ -42,30 +42,35 @@ sub run { my $vault = $descr->{VaultARN}; $vault =~ s{.*:vaults/}{}; - return if $descr->{Completed}; + my $completed = $descr->{Completed}; $self->debug(2, "$descr->{JobId} $descr->{Action} $vault"); if ($descr->{StatusCode} eq 'Failed') { - $self->debug(1, "deleting failed $key $vault " . - ($descr->{JobDescription} || $descr->{Action}) . - $descr->{JobId}); + $self->debug(1, + "deleting failed $key $vault " + . ($descr->{JobDescription} || $descr->{Action}) + . ' ' + . $descr->{JobId}); $db->delete($key) unless $self->dry_run; } my $res = $self->glacier->Describe_job($vault, $descr->{JobId}); if ($self->glacier->lasterr) { if ($self->glacier->lasterr('code') == 404) { - $self->debug(1, "deleting expired $key $vault " . - ($descr->{JobDescription} || $descr->{Action}) . - $descr->{JobId}); - $db->delete($key) unless $self->dry_run; + $self->debug(1, + "deleting expired $key $vault " + . ($descr->{JobDescription} || $descr->{Action}) + . ' ' + . $descr->{JobId}); + App::Glacier::Job->fromdb($self, $vault, $key, $res)->delete() + unless $self->dry_run; } else { $self->error("can't describe job $descr->{JobId}: ", $self->glacier->last_error_message); } } elsif (ref($res) ne 'HASH') { croak "describe_job returned wrong datatype (".ref($res).") for \"$descr->{JobId}\""; - } else { + } elsif ($res->{Completed} ne $completed) { $self->debug(2, $res->{StatusCode}); if ($res->{Completed} && $res->{StatusCode} eq 'Succeeded') { $self->debug(1, "$descr->{JobId}: processing $descr->{Action} for $vault"); |