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.pm21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/App/Glacier/Command.pm b/lib/App/Glacier/Command.pm
index 449950c..62a236b 100644
--- a/lib/App/Glacier/Command.pm
+++ b/lib/App/Glacier/Command.pm
@@ -97,9 +97,11 @@ sub new {
my $argref = shift;
local %_ = @_;
- my $config_file = delete $_{config}
- || $ENV{GLACIER_CONF}
- || "/etc/glacier.conf";
+ my $config_file = delete $_{config} || $ENV{GLACIER_CONF};
+ unless ($config_file) {
+ $config_file = -f '/etc/glacier.conf'
+ ? '/etc/glacier.conf' : '/dev/null';
+ }
my $account = delete $_{account};
my $region = delete $_{region};
@@ -139,19 +141,12 @@ sub new {
$region = $creds->region($account) unless defined $region;
}
}
- $self->abend(EX_CONFIG, "no access credentials found")
- unless ($self->{_config}->isset(qw(glacier access))
- && $self->{_config}->isset(qw(glacier secret)));
}
- if ($region) {
- $self->{_config}->set(qw(glacier region), $region);
- } elsif (!$self->{_config}->isset(qw(glacier region))) {
- $self->{_config}->set(qw(glacier region), 'eu-west-1');
+ $self->{_glacier} = new App::Glacier::Bre(%{$self->config->as_hash('glacier')//{}});
+ if ($self->{_glacier}->lasterr) {
+ $self->abend(EX_CONFIG, $self->{_glacier}->last_error_message);
}
-
- $self->{_glacier} = new App::Glacier::Bre(%{$self->config->as_hash('glacier')});
-
return $self;
}

Return to:

Send suggestions and report system problems to the System administrator.