diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-12-18 20:33:46 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-12-18 20:33:46 +0200 |
commit | 249512af92d3f592ae683279c2cd1f54a7c1a726 (patch) | |
tree | e71528045c19978bac042c7d6f52cc3485d4feea | |
parent | 728992688946fe88173e7cd561456a10c9d23fd8 (diff) | |
download | glacier-249512af92d3f592ae683279c2cd1f54a7c1a726.tar.gz glacier-249512af92d3f592ae683279c2cd1f54a7c1a726.tar.bz2 |
Fix periodic subcommand
-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 | |||
@@ -28,4 +28,4 @@ sub new { | |||
28 | # FIXME: The attribute itself is not documented, so this | 28 | # FIXME: The attribute itself is not documented, so this |
29 | # this method may fail if the internals of the base class | 29 | # method may fail if the internals of the base class change |
30 | # change in its future releases. | 30 | # in its future releases. |
31 | # This approach works with Net::Amazon::Glacier 0.15 | 31 | # This approach works with Net::Amazon::Glacier 0.15 |
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 | |||
@@ -8,2 +8,3 @@ use Data::Dumper; | |||
8 | use App::Glacier::Timestamp; | 8 | use App::Glacier::Timestamp; |
9 | use App::Glacier::Job; | ||
9 | 10 | ||
@@ -138,3 +139,4 @@ sub list { | |||
138 | $descr->{JobId}); | 139 | $descr->{JobId}); |
139 | $db->delete($key) unless $self->dry_run; | 140 | App::Glacier::Job->fromdb($self, $vault, $key, $res)->delete() |
141 | unless $self->dry_run; | ||
140 | return; | 142 | return; |
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 | |||
@@ -44,3 +44,3 @@ sub run { | |||
44 | 44 | ||
45 | return if $descr->{Completed}; | 45 | my $completed = $descr->{Completed}; |
46 | 46 | ||
@@ -48,5 +48,7 @@ sub run { | |||
48 | if ($descr->{StatusCode} eq 'Failed') { | 48 | if ($descr->{StatusCode} eq 'Failed') { |
49 | $self->debug(1, "deleting failed $key $vault " . | 49 | $self->debug(1, |
50 | ($descr->{JobDescription} || $descr->{Action}) . | 50 | "deleting failed $key $vault " |
51 | $descr->{JobId}); | 51 | . ($descr->{JobDescription} || $descr->{Action}) |
52 | . ' ' | ||
53 | . $descr->{JobId}); | ||
52 | $db->delete($key) unless $self->dry_run; | 54 | $db->delete($key) unless $self->dry_run; |
@@ -57,6 +59,9 @@ sub run { | |||
57 | if ($self->glacier->lasterr('code') == 404) { | 59 | if ($self->glacier->lasterr('code') == 404) { |
58 | $self->debug(1, "deleting expired $key $vault " . | 60 | $self->debug(1, |
59 | ($descr->{JobDescription} || $descr->{Action}) . | 61 | "deleting expired $key $vault " |
60 | $descr->{JobId}); | 62 | . ($descr->{JobDescription} || $descr->{Action}) |
61 | $db->delete($key) unless $self->dry_run; | 63 | . ' ' |
64 | . $descr->{JobId}); | ||
65 | App::Glacier::Job->fromdb($self, $vault, $key, $res)->delete() | ||
66 | unless $self->dry_run; | ||
62 | } else { | 67 | } else { |
@@ -67,3 +72,3 @@ sub run { | |||
67 | croak "describe_job returned wrong datatype (".ref($res).") for \"$descr->{JobId}\""; | 72 | croak "describe_job returned wrong datatype (".ref($res).") for \"$descr->{JobId}\""; |
68 | } else { | 73 | } elsif ($res->{Completed} ne $completed) { |
69 | $self->debug(2, $res->{StatusCode}); | 74 | $self->debug(2, $res->{StatusCode}); |