[Rt-commit] rt branch, 4.0/split-crontool-output, updated. rt-4.0.2-26-gbf3f0d1

Alex Vandiver alexmv at bestpractical.com
Tue Sep 6 14:55:54 EDT 2011


The branch, 4.0/split-crontool-output has been updated
       via  bf3f0d1781779100e6bdc4cabe05982fdbacc9e8 (commit)
      from  ca21b140d85cc4ca12dddeb89c73830e1ae6c9a5 (commit)

Summary of changes:
 bin/rt-crontool.in |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit bf3f0d1781779100e6bdc4cabe05982fdbacc9e8
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 6 14:55:38 2011 -0400

    Make rt-crontool --verbose output more human-readable
    
    Rather than just adding one perline per ticket, place each debug message
    on its own line, indented under the ticket number.  This makes the
    output possibly legible to end-users, which is presumably the point of
    the loc() calls.

diff --git a/bin/rt-crontool.in b/bin/rt-crontool.in
index 0766e10..c1b2bcb 100755
--- a/bin/rt-crontool.in
+++ b/bin/rt-crontool.in
@@ -166,7 +166,7 @@ my $tickets = $search->TicketsObj;
 
 #for each ticket we've found
 while ( my $ticket = $tickets->Next() ) {
-    print $ticket->Id() . ": " if ($verbose);
+    print $ticket->Id() . ":\n" if ($verbose);
 
     my $template_obj = get_template( $ticket );
 
@@ -174,20 +174,19 @@ while ( my $ticket = $tickets->Next() ) {
         my $txns = get_transactions($ticket);
         my $found = 0;
         while ( my $txn = $txns->Next ) {
-            print loc("Using transaction #[_1]...", $txn->id)
+            print "\t".loc("Using transaction #[_1]...", $txn->id)."\n"
                 if $verbose;
             process($ticket, $txn, $template_obj);
             $found = 1;
         }
-        print loc("Couldn't find suitable transaction, skipping")
+        print "\t".loc("Couldn't find suitable transaction, skipping")."\n"
             if $verbose && !$found;
     } else {
-        print loc("Processing without transaction, some conditions and actions may fail. Consider using --transaction argument")
+        print "\t".loc("Processing without transaction, some conditions and actions may fail. Consider using --transaction argument")."\n"
             if $verbose;
 
         process($ticket, undef, $template_obj);
     }
-    print "\n" if $verbose;
 }
 
 sub process {
@@ -209,7 +208,7 @@ sub process {
         # if the condition doesn't apply, get out of here
 
         return unless $condition_obj->IsApplicable;
-        print loc("Condition matches...") if $verbose;
+        print "\t".loc("Condition matches...")."\n" if $verbose;
     }
 
     #prepare our action
@@ -225,11 +224,11 @@ sub process {
 
     #if our preparation, move onto the next ticket
     return unless $action_obj->Prepare;
-    print loc("Action prepared...") if $verbose;
+    print "\t".loc("Action prepared...")."\n" if $verbose;
 
     #commit our action.
     return unless $action_obj->Commit;
-    print loc("Action committed.") if $verbose;
+    print "\t".loc("Action committed.")."\n" if $verbose;
 }
 
 # =head2 get_transactions
@@ -386,7 +385,7 @@ sub help {
     print loc("Escalate tickets"). "\n";
     print " bin/rt-crontool \\\n";
     print "  --search RT::Search::ActiveTicketsInQueue  --search-arg general \\\n";
-    print "  --action RT::Action::EscalatePriority\n";
+    print"  --action RT::Action::EscalatePriority\n";
  
  
  

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


More information about the Rt-commit mailing list