summaryrefslogtreecommitdiffabout
path: root/lib/App/Glacier/Command/Jobs.pm
Side-by-side diff
Diffstat (limited to 'lib/App/Glacier/Command/Jobs.pm') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/App/Glacier/Command/Jobs.pm39
1 files changed, 7 insertions, 32 deletions
diff --git a/lib/App/Glacier/Command/Jobs.pm b/lib/App/Glacier/Command/Jobs.pm
index 5a5f488..7dc5d06 100644
--- a/lib/App/Glacier/Command/Jobs.pm
+++ b/lib/App/Glacier/Command/Jobs.pm
@@ -118,5 +118,3 @@ sub list {
$db->foreach(sub {
- my ($key, $descr) = @_;
- my $vault = $descr->{VaultARN};
- $vault =~ s{.*:vaults/}{};
+ my ($key, $descr, $vault) = @_;
@@ -125,31 +123,8 @@ sub list {
unless ($self->{_options}{cached}) {
- if ($descr->{StatusCode} eq 'Failed') {
- $self->debug(1, "deleting failed $key $vault " .
- ($descr->{JobDescription} || $descr->{Action}) .
- $descr->{JobId});
- $db->delete($key) unless $self->dry_run;
- return;
- }
-
- 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});
- App::Glacier::Job->fromdb($self, $vault, $key, $res)->delete()
- unless $self->dry_run;
- return;
- } 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 {
- $res = timestamp_deserialize($res);
- $self->debug(2, $res->{StatusCode});
- $db->store($key, $res) unless $self->dry_run;
- $descr = $res;
- }
+ my $res = $self->check_job($key, $descr, $vault)
+ or return;
+ $res = timestamp_deserialize($res);
+ $self->debug(2, $res->{StatusCode});
+ $db->store($key, $res) unless $self->dry_run;
+ $descr = $res;
}

Return to:

Send suggestions and report system problems to the System administrator.