[Rt-commit] rt branch, 4.4/external-storage, updated. rt-4.2.11-70-gda32d14

Shawn Moore shawn at bestpractical.com
Wed May 27 13:13:35 EDT 2015


The branch, 4.4/external-storage has been updated
       via  da32d146747ed1c6a16b05d4fc958cc684888a1f (commit)
      from  473b1d11acd11510380627bff922d29b7cd636fb (commit)

Summary of changes:
 lib/RT/ExternalStorage/AmazonS3.pm | 15 ++++++---------
 lib/RT/ExternalStorage/Disk.pm     |  4 ++--
 lib/RT/ExternalStorage/Dropbox.pm  |  2 +-
 3 files changed, 9 insertions(+), 12 deletions(-)

- Log -----------------------------------------------------------------
commit da32d146747ed1c6a16b05d4fc958cc684888a1f
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed May 27 17:13:21 2015 +0000

    Better error messages for missing attributes

diff --git a/lib/RT/ExternalStorage/AmazonS3.pm b/lib/RT/ExternalStorage/AmazonS3.pm
index 1692463..6b4440f 100644
--- a/lib/RT/ExternalStorage/AmazonS3.pm
+++ b/lib/RT/ExternalStorage/AmazonS3.pm
@@ -88,17 +88,14 @@ sub Init {
     if (not Amazon::S3->require) {
         RT->Logger->error("Required module Amazon::S3 is not installed");
         return;
-    } elsif (not $self->AccessKeyId) {
-        RT->Logger->error("AccessKeyId not provided for AmazonS3");
-        return;
-    } elsif (not $self->SecretAccessKey) {
-        RT->Logger->error("SecretAccessKey not provided for AmazonS3");
-        return;
-    } elsif (not $self->Bucket) {
-        RT->Logger->error("Bucket not provided for AmazonS3");
-        return;
     }
 
+    for my $key (qw/AccessKeyId SecretAccessKey Bucket/) {
+        if (not $self->$key) {
+            RT->Logger->error("Required option '$key' not provided for AmazonS3 external storage. See the documentation for " . __PACKAGE__ . " for setting up this integration.");
+            return;
+        }
+    }
 
     my $S3 = Amazon::S3->new( {
         aws_access_key_id     => $self->AccessKeyId,
diff --git a/lib/RT/ExternalStorage/Disk.pm b/lib/RT/ExternalStorage/Disk.pm
index a5e9cfb..d8bc6af 100644
--- a/lib/RT/ExternalStorage/Disk.pm
+++ b/lib/RT/ExternalStorage/Disk.pm
@@ -65,10 +65,10 @@ sub Init {
     my $self = shift;
 
     if (not $self->Path) {
-        RT->Logger->error("No path provided for local storage");
+        RT->Logger->error("Required option 'Path' not provided for Disk external storage.");
         return;
     } elsif (not -e $self->Path) {
-        RT->Logger->error("Path provided for local storage (".$self->Path.") does not exist");
+        RT->Logger->error("Path provided for Disk external storage (".$self->Path.") does not exist");
         return;
     }
 
diff --git a/lib/RT/ExternalStorage/Dropbox.pm b/lib/RT/ExternalStorage/Dropbox.pm
index 0841d8b..f97eaf0 100644
--- a/lib/RT/ExternalStorage/Dropbox.pm
+++ b/lib/RT/ExternalStorage/Dropbox.pm
@@ -69,7 +69,7 @@ sub Init {
         RT->Logger->error("Required module File::Dropbox is not installed");
         return;
     } elsif (not $self->{AccessToken}) {
-        RT->Logger->error("AccessToken not provided for Dropbox. See the documentation for " . __PACKAGE__ . " for setting up this integration.");
+        RT->Logger->error("Required option 'AccessToken' not provided for Dropbox external storage. See the documentation for " . __PACKAGE__ . " for setting up this integration.");
         return;
     }
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list