[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-613-gf50c064

? sunnavy sunnavy at bestpractical.com
Fri Aug 27 01:48:04 EDT 2010


The branch, 3.9-trunk has been updated
       via  f50c0643f843d723c3c668640f4a6d89d0a5acf6 (commit)
      from  91bc05f29f9a776666e451afaca3b70ebe1cecd2 (commit)

Summary of changes:
 bin/rt-crontool.in      |  131 +++++++++++++++++++++++++++++++++++++++--------
 bin/rt.in               |   27 ++++++++++
 sbin/rt-email-digest.in |   53 ++++++++++++++++---
 3 files changed, 182 insertions(+), 29 deletions(-)

- Log -----------------------------------------------------------------
commit f50c0643f843d723c3c668640f4a6d89d0a5acf6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Aug 27 13:48:30 2010 +0800

    add perldoc to rt scripts which miss that

diff --git a/bin/rt-crontool.in b/bin/rt-crontool.in
index b48021a..61f614d 100755
--- a/bin/rt-crontool.in
+++ b/bin/rt-crontool.in
@@ -231,13 +231,13 @@ sub process {
     print loc("Action committed.\n") if $verbose;
 }
 
-=head2 get_transactions
-
-Takes ticket and returns L<RT::Transactions> object with transactions
-of the ticket according to command line arguments C<--transaction>
-and <--transaction-type>.
-
-=cut
+# =head2 get_transactions
+# 
+# Takes ticket and returns L<RT::Transactions> object with transactions
+# of the ticket according to command line arguments C<--transaction>
+# and <--transaction-type>.
+# 
+# =cut
 
 sub get_transactions {
     my $ticket = shift;
@@ -258,11 +258,11 @@ sub get_transactions {
     return $txns;
 }
 
-=head2 get_template
-
-Takes a ticket and returns a template according to command line options.
-
-=cut
+# =head2 get_template
+# 
+# Takes a ticket and returns a template according to command line options.
+# 
+# =cut
 
 { my $cache = undef;
 sub get_template {
@@ -295,11 +295,11 @@ sub get_template {
 
 # {{{ load_module 
 
-=head2 load_module
-
-Loads a perl module, dying nicely if it can't find it.
-
-=cut
+# =head2 load_module
+# 
+# Loads a perl module, dying nicely if it can't find it.
+# 
+# =cut
 
 sub load_module {
     my $modname = shift;
@@ -314,11 +314,11 @@ sub load_module {
 
 # {{{ loc 
 
-=head2 loc LIST
-
-Localize this string, with the current user's currentuser object
-
-=cut
+# =head2 loc LIST
+# 
+# Localize this string, with the current user's currentuser object
+# 
+# =cut
 
 sub loc {
     $CurrentUser->loc(@_);
@@ -398,3 +398,90 @@ sub help {
 
     exit(0);
 }
+
+__END__
+
+=head1 NAME
+
+rt-crontool - a tool to act on tickets from an external scheduling tool
+
+=head1 SYNOPSIS
+
+    # find all active tickets in the queue 'general' and set their priority to 99 if they are overdue:
+    rt-crontool \
+      --search RT::Search::ActiveTicketsInQueue  --search-arg general \
+      --condition RT::Condition::Overdue \
+      --action RT::Action::SetPriority --action-arg 99 \
+      --verbose
+
+    # Escalate tickets
+      rt-crontool \
+        --search RT::Search::ActiveTicketsInQueue  --search-arg general \
+        --action RT::Action::EscalatePriority
+
+=head1 DESCRIPTION
+
+This script is a tool to act on tickets from an external scheduling tool, such
+as cron.
+
+Security:
+
+This tool allows the user to run arbitrary perl modules from within RT. If
+this tool were setgid, a hostile local user could use this tool to gain
+administrative access to RT. It is incredibly important that nonprivileged
+users not be allowed to run this tool. It is suggested that you create a
+non-privileged unix user with the correct group membership and RT access to
+run this tool.
+
+
+=head1 OPTIONS
+
+=over
+
+=item search 
+
+Specify the search module you want to use
+
+=item search-arg 
+
+An argument to pass to --search
+
+=item condition
+
+Specify the condition module you want to use
+
+=item condition-arg
+
+An argument to pass to --condition
+
+=item action 
+
+Specify the action module you want to use
+
+=item action-arg
+
+An argument to pass to --action
+
+=item template
+
+Specify name or id of template(s) you want to use
+
+=item transaction
+
+Specify if you want to use either 'first', 'last' or 'all' transactions
+
+
+=item transaction-type
+
+Specify the comma separated list of transactions' types you want to use
+
+=item log
+
+Adjust LogToScreen config option
+
+=item verbose
+
+Output status updates to STDOUT
+
+=back
+
diff --git a/bin/rt.in b/bin/rt.in
index e6ebe97..710b632 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -51,6 +51,12 @@
 
 use strict;
 
+if ( $ARGV[0] =~ /^(?:--help|-h)$/ ) {
+    require Pod::Usage;
+    print Pod::Usage::pod2usage( { verbose => 2 } );
+    exit;
+}
+
 # This program is intentionally written to have as few non-core module
 # dependencies as possible. It should stay that way.
 
@@ -2584,3 +2590,24 @@ Text:
         $ rt shell
         rt> quit
         $
+
+__END__
+
+=head1 NAME
+
+rt - command-line interface to RT 3.0 or newer
+
+=head1 SYNOPSIS
+
+    rt help
+
+=head1 DESCRIPTION
+
+This script allows you to interact with an RT server over HTTP, and offers an
+interface to RT's functionality that is better-suited to automation and
+integration with other tools.
+
+In general, each invocation of this program should specify an action to
+perform on one or more objects, and any other arguments required to complete
+the desired action.
+
diff --git a/sbin/rt-email-digest.in b/sbin/rt-email-digest.in
index c1ad2d9..21873cc 100644
--- a/sbin/rt-email-digest.in
+++ b/sbin/rt-email-digest.in
@@ -188,13 +188,13 @@ sub send_digest {
     }
 }
 
-=item mark_transactions_sent( $frequency, $user, @txn_list );
-
-Takes a frequency string (either 'daily' or 'weekly'), a user  and one or more
-transaction objects as its arguments.  Marks the given deferred
-notifications as sent.
-
-=cut
+# =item mark_transactions_sent( $frequency, $user, @txn_list );
+# 
+# Takes a frequency string (either 'daily' or 'weekly'), a user  and one or more
+# transaction objects as its arguments.  Marks the given deferred
+# notifications as sent.
+# 
+# =cut
 
 sub mark_transactions_sent {
     my ( $freq, $user, @txns ) = @_;
@@ -335,3 +335,42 @@ sub build_digest_for_user {
     return ( $contents_list, $contents_body );
 
 }
+
+__END__
+
+=head1 NAME
+
+rt-email-digest - dispatch deferred notifications as a per-user digest
+
+=head1 SYNOPSIS
+
+    rt-email-digest -m (daily|weekly) [--print] [--help]
+
+=head1 DESCRIPTION
+
+This script is a tool to dispatch all deferred RT notifications as a per-user
+object.
+
+=head1 OPTIONS
+
+=over
+
+=item mode
+
+Specify whether this is a daily or weekly run.
+
+--mode is equal to -m
+
+=item print
+
+Print the resulting digest messages to STDOUT; don't mail them. Do not mark them as sent
+
+--print is equal to -p
+
+=item help
+
+Print this message
+
+--help is equal to -h
+
+=back

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


More information about the Rt-commit mailing list