[Rt-commit] rt branch, 4.4/crontool-dry-run, created. rt-4.4.3-68-g90bbff572
? sunnavy
sunnavy at bestpractical.com
Tue Nov 20 15:52:30 EST 2018
The branch, 4.4/crontool-dry-run has been created
at 90bbff572425b084ec89fbecd93c82bbb2d3025b (commit)
- Log -----------------------------------------------------------------
commit 90bbff572425b084ec89fbecd93c82bbb2d3025b
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Nov 21 04:40:28 2018 +0800
Add --dry-run option to rt-crontool
When the option is on, skip the action Commit code.
diff --git a/bin/rt-crontool.in b/bin/rt-crontool.in
index 770bfdb0a..fcda651a2 100644
--- a/bin/rt-crontool.in
+++ b/bin/rt-crontool.in
@@ -74,7 +74,7 @@ use Getopt::Long;
use RT::Interface::CLI qw(GetCurrentUser loc);
my ( $search, $condition, $actions, $search_arg, $condition_arg, $actions_arg,
- $template, $template_id, $transaction, $transaction_type, $help, $log, $verbose );
+ $template, $template_id, $transaction, $transaction_type, $help, $log, $verbose, $dryrun );
GetOptions(
"search=s" => \$search,
"search-arg=s" => \$search_arg,
@@ -88,6 +88,7 @@ GetOptions(
"transaction-type=s" => \$transaction_type,
"log=s" => \$log,
"verbose|v" => \$verbose,
+ "dry-run" => \$dryrun,
"help" => \$help,
);
@@ -228,6 +229,7 @@ sub process {
next unless $action_obj->Prepare;
print "\t".loc("Action prepared...")."\n" if $verbose;
+ next if $dryrun;
# commit our action.
next unless $action_obj->Commit;
print "\t".loc("Action committed.")."\n" if $verbose;
@@ -461,5 +463,10 @@ Adjust LogToSTDERR config option
Output status updates to STDOUT
+=item dry-run
+
+Actions are composed of 2 parts: "Prepare" and "Commit". C<dry-run>
+skips the "Commit" part.
+
=back
-----------------------------------------------------------------------
More information about the rt-commit
mailing list