aboutsummaryrefslogtreecommitdiff
path: root/lib/App
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-03-06 09:22:07 +0200
committerSergey Poznyakoff <gray@gnu.org>2018-03-06 09:27:27 +0200
commit272ebc9cfd4e29429e0550d30c75c20e1bef4d89 (patch)
tree5afc75f01a17341cd3a30129dfed2b3a64c872ef /lib/App
parent86fb141c932c2305dbb096db36c929f4931f0c04 (diff)
downloadglacier-272ebc9cfd4e29429e0550d30c75c20e1bef4d89.tar.gz
glacier-272ebc9cfd4e29429e0550d30c75c20e1bef4d89.tar.bz2
Minor changes
* lib/App/Glacier.pm: Make sure the NAME section begins with the package name, otherwise MakeMaker is unable to retrieve abstract from it. This creates wrongly named manpage, though. * lib/App/Glacier/Command/ListVault.pm: New option --cached. Use --sort=name by default. * lib/App/Glacier/Job.pm: Display the diagnostics received from Amazon in case of 404 response.
Diffstat (limited to 'lib/App')
-rw-r--r--lib/App/Glacier.pm2
-rw-r--r--lib/App/Glacier/Command/ListVault.pm32
-rw-r--r--lib/App/Glacier/Command/Purge.pm3
-rw-r--r--lib/App/Glacier/Job.pm5
4 files changed, 26 insertions, 16 deletions
diff --git a/lib/App/Glacier.pm b/lib/App/Glacier.pm
index 9e4fbb1..47ed91c 100644
--- a/lib/App/Glacier.pm
+++ b/lib/App/Glacier.pm
@@ -90,7 +90,7 @@ __END__
=head1 NAME
-App::Glacier, glacier - command line utility for accessing Amazon Glacier storage
+App::Glacier - command line utility for accessing Amazon Glacier storage
=head1 SYNOPSIS
diff --git a/lib/App/Glacier/Command/ListVault.pm b/lib/App/Glacier/Command/ListVault.pm
index df34c38..c19e7e7 100644
--- a/lib/App/Glacier/Command/ListVault.pm
+++ b/lib/App/Glacier/Command/ListVault.pm
@@ -16,7 +16,8 @@ glacier ls - list vaults or archives
=head1 SYNOPSIS
B<glacier ls>
-[B<-SUdlhtr>]
+[B<-SUcdlhtr>]
+[B<--cached>]
[B<--human-readable>]
[B<--sort=>B<none>|B<name>|B<time>|B<size>]
[B<--reverse>]
@@ -53,6 +54,10 @@ Sort by file size, largest first.
=item B<--sort=none>
Don't sort names.
+
+=item B<-c>, B<--cached>
+
+Display cached inventory content.
=item B<-d>, B<--directory>
@@ -171,6 +176,7 @@ sub new {
my $self = $class->SUPER::new(
$argref,
optmap => {
+ 'cached|c' => 'cached',
'directory|d' => 'd',
'l' => 'l',
'sort=s' => 'sort',
@@ -183,14 +189,14 @@ sub new {
}, %opts);
$self->{_options}{d} = 1 if ($self->command_line == 0);
-
- if (defined($self->{_options}{sort})) {
- my $sortfun = $self->{_options}{d}
+ $self->{_options}{sort} //= 'name';
+
+ my $sortfun = $self->{_options}{d}
? \%sort_vaults : \%sort_archives;
- $self->usage_error("unknown sort field")
- unless exists($sortfun->{$self->{_options}{sort}});
- $self->{_options}{sort} = $sortfun->{$self->{_options}{sort}};
- }
+ $self->usage_error("unknown sort field")
+ unless exists($sortfun->{$self->{_options}{sort}});
+ $self->{_options}{sort} = $sortfun->{$self->{_options}{sort}};
+
return $self;
}
@@ -298,10 +304,12 @@ sub get_vault_inventory {
$self->abend(EX_FAILURE, "no such vault: $vault_name")
unless defined $dir;
- if ($dir->status == DIR_PENDING) {
- require App::Glacier::Command::Sync;
- my $sync = new App::Glacier::Command::Sync;
- $sync->sync($vault_name) or exit(EX_TEMPFAIL);
+ unless ($self->{_options}{cached}) {
+ if ($dir->status == DIR_PENDING) {
+ require App::Glacier::Command::Sync;
+ my $sync = new App::Glacier::Command::Sync;
+ $sync->sync($vault_name) or exit(EX_TEMPFAIL);
+ }
}
my @glob;
diff --git a/lib/App/Glacier/Command/Purge.pm b/lib/App/Glacier/Command/Purge.pm
index 64b5bbc..44fafb4 100644
--- a/lib/App/Glacier/Command/Purge.pm
+++ b/lib/App/Glacier/Command/Purge.pm
@@ -48,8 +48,7 @@ sub new {
$argref,
optmap => {
'interactive|i' => 'interactive',
- 'force|f' => sub { $_[0]->{_options}{interactive} = 0
- },
+ 'force|f' => sub { $_[0]->{_options}{interactive} = 0 },
%opts);
$self->{_options}{interactive} //= 1;
$self
diff --git a/lib/App/Glacier/Job.pm b/lib/App/Glacier/Job.pm
index 4195418..1906de1 100644
--- a/lib/App/Glacier/Job.pm
+++ b/lib/App/Glacier/Job.pm
@@ -51,7 +51,10 @@ sub _get_job {
my $jid = $self->{_cmd}->glacier_eval(@{$self->{_init}});
if ($self->{_cmd}->lasterr) {
if ($self->{_cmd}->lasterr('code') == 404) {
- $self->{_cmd}->abend(EX_TEMPFAIL, "vault is empty");
+ $self->{_cmd}->abend(EX_TEMPFAIL,
+ $self->{_cmd}->last_error_message
+ . "\n"
+ . "Try again later or use the --cached option to see the cached content.")
} else {
$self->{_cmd}->abend(EX_FAILURE,
"can't create job: ",

Return to:

Send suggestions and report system problems to the System administrator.