[Rt-commit] r8413 - rtir/branches/2.3-EXPERIMENTAL/etc

ruz at bestpractical.com ruz at bestpractical.com
Mon Aug 6 21:15:59 EDT 2007


Author: ruz
Date: Mon Aug  6 21:15:58 2007
New Revision: 8413

Modified:
   rtir/branches/2.3-EXPERIMENTAL/etc/add_constituency

Log:
* don't fail if principal already has a right, just skip with debug note

Modified: rtir/branches/2.3-EXPERIMENTAL/etc/add_constituency
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/etc/add_constituency	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/etc/add_constituency	Mon Aug  6 21:15:58 2007
@@ -196,8 +196,13 @@
         foreach my $right  (@rights) {
             my ($val,$msg) =  $group->PrincipalObj->GrantRight(Right => $right, Object=>$queue);
             debug "\t$right\n";
-            unless ($val) {
-                die "Failed to grant $right to ".$group->name. " for Queue ". $queue->Name;
+            if ( $val ) {
+                debug "\t...done.";
+            }
+            elsif ( $msg =~ /That principal already has that right/i ) {
+                debug "\t...skipped, already granted.\n";
+            } else {
+                die "Failed to grant $right to ". $group->Name ." for Queue ". $queue->Name;
             }
         }
     } 
@@ -215,8 +220,13 @@
 
         foreach my $right  (@rights) {
             my ($val,$msg) =  $group->PrincipalObj->GrantRight(Right => $right, Object=>$cf);
-            print "\t$right\n";
-            unless ($val) {
+            debug "\t$right";
+            if ( $val ) {
+                debug "\t...done.";
+            }
+            elsif ( $msg =~ /That principal already has that right/i ) {
+                debug "\t...skipped, already granted.\n";
+            } else {
                 die "Failed to grant $right to ".$group->Name. " for Custom Field ". $cf->Name
                     .".\nError: $msg";
             }


More information about the Rt-commit mailing list