[Bps-public-commit] SD branch, master, updated. 0.73-15-g56847fb

spang at bestpractical.com spang at bestpractical.com
Mon Sep 28 01:18:01 EDT 2009


The branch, master has been updated
       via  56847fb52dd7519f379cec161b64959dbe2018d9 (commit)
       via  95ef7bbffb7163d72a1ba851410383d6d592cd1e (commit)
       via  ea470c12b37b882dc27f04d716b10edd1eafb4f8 (commit)
      from  6916fc9aca20b6b6e7015322938fe36356695447 (commit)

Summary of changes:
 lib/App/SD/Replica/rt.pm |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit ea470c12b37b882dc27f04d716b10edd1eafb4f8
Author: Christine Spang <spang at mit.edu>
Date:   Sun Sep 27 23:26:26 2009 -0400

    friendlier error message if user tries to sync with RT without RT::Client::REST

diff --git a/lib/App/SD/Replica/rt.pm b/lib/App/SD/Replica/rt.pm
index 90f2e5b..ea7d66e 100644
--- a/lib/App/SD/Replica/rt.pm
+++ b/lib/App/SD/Replica/rt.pm
@@ -23,9 +23,15 @@ sub BUILD {
     my $self = shift;
 
     # Require rather than use to defer load
-    require RT::Client::REST;
-    require RT::Client::REST::User;
-    require RT::Client::REST::Ticket;
+    eval {
+        require RT::Client::REST;
+        require RT::Client::REST::User;
+        require RT::Client::REST::Ticket;
+    };
+    if ($@) {
+        warn $@ if $ENV{PROPHET_DEBUG};
+        die "RT::Client::REST is required to sync with RT foreign replicas.\n";
+    }
 
     my ( $server, $type, $query ) = $self->{url} =~ m/^rt:(.*?)\|(.*?)\|(.*)$/
         or die "Can't parse RT server spec. Expected rt:http://example.com|QUEUE|QUERY. Try: rt:http://example.com/|General|";

commit 95ef7bbffb7163d72a1ba851410383d6d592cd1e
Author: Christine Spang <spang at mit.edu>
Date:   Mon Sep 28 00:48:22 2009 -0400

    Check for http:// in RT URL regex since RT::Client::REST expects it
    
    Previously, entering something like rt.cpan.org would give an obscure error about URI::_generic

diff --git a/lib/App/SD/Replica/rt.pm b/lib/App/SD/Replica/rt.pm
index ea7d66e..0a98607 100644
--- a/lib/App/SD/Replica/rt.pm
+++ b/lib/App/SD/Replica/rt.pm
@@ -33,8 +33,9 @@ sub BUILD {
         die "RT::Client::REST is required to sync with RT foreign replicas.\n";
     }
 
-    my ( $server, $type, $query ) = $self->{url} =~ m/^rt:(.*?)\|(.*?)\|(.*)$/
-        or die "Can't parse RT server spec. Expected rt:http://example.com|QUEUE|QUERY. Try: rt:http://example.com/|General|";
+    my ( $server, $type, $query ) = $self->{url} =~ m{^rt:(http://.*?)\|(.*?)\|(.*)$}
+        or die "Can't parse RT server spec. Expected 'rt:http://example.com|QUEUE|QUERY'.\n"
+                ."Try: 'rt:http://example.com/|General|'.\n";
     my $uri = URI->new($server);
     my ( $username, $password );
     if ( my $auth = $uri->userinfo ) {

commit 56847fb52dd7519f379cec161b64959dbe2018d9
Author: Christine Spang <spang at mit.edu>
Date:   Mon Sep 28 00:48:56 2009 -0400

    Report back errors on login failure in RT sync

diff --git a/lib/App/SD/Replica/rt.pm b/lib/App/SD/Replica/rt.pm
index 0a98607..ed87f79 100644
--- a/lib/App/SD/Replica/rt.pm
+++ b/lib/App/SD/Replica/rt.pm
@@ -55,7 +55,13 @@ sub BUILD {
 
     $self->rt_username($username);
 
-    $self->rt->login( username => $username, password => $password );
+    eval {
+        $self->rt->login( username => $username, password => $password );
+    };
+    if ($@) {
+        die "Login to '$server' with username '$username' failed!\n"
+            ."Error was: $@.\n";
+    }
 }
 
 sub foreign_username { return shift->rt_username(@_)}

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



More information about the Bps-public-commit mailing list