[Rt-commit] rtir branch, 5.0/fix-disablecountermeasures-config-option, created. 5.0.0-15-g703a2cb6
Craig Kaiser
craig at bestpractical.com
Fri Jan 8 10:28:44 EST 2021
The branch, 5.0/fix-disablecountermeasures-config-option has been created
at 703a2cb6efcf9825c54753bd655647198604dc97 (commit)
- Log -----------------------------------------------------------------
commit 703a2cb6efcf9825c54753bd655647198604dc97
Author: craig kaiser <craig at bestpractical.com>
Date: Mon Jan 4 09:01:50 2021 -0500
Remove 'Countermeasures' from linked queues when RTIR_DisableCountermeasures enabled
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 897f5abb..59267222 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -66,6 +66,34 @@ use RT::IR::ConstituencyManager;
RT::IR::Config::Init();
+if ( RT::Config->Get( 'RTIR_DisableCountermeasures' ) ) {
+ my $orig_check = $RT::Config::META{'LinkedQueuePortlets'}{'PostLoadCheck'};
+
+ $RT::Config::META{'LinkedQueuePortlets'}{'PostLoadCheck'} = sub {
+ $orig_check->(@_) if $orig_check;
+ my $LinkedQueuePortlets = $RT::Config->Get( 'LinkedQueuePortlets' ) || {};
+
+ my $queue_obj = RT::Queue->new( RT->SystemUser );
+ foreach my $queue ( keys %{$LinkedQueuePortlets} ) {
+ my $linked_queues = $LinkedQueuePortlets->{$queue};
+
+ my @queues;
+ foreach my $linked_queue ( @{$linked_queues} ) {
+ my ($queue_name) = keys %{$linked_queue};
+
+ my ($ret, $msg) = $queue_obj->Load( $queue_name );
+ unless ( $ret ) {
+ RT::Logger->error( "Could not load queue $queue_name from \%LinkedQueuePortlets hash: $msg" );
+ next;
+ }
+
+ next if $queue_obj->Lifecycle eq RT::IR->lifecycle_countermeasure;
+ push @queues, $linked_queue;
+ }
+ $LinkedQueuePortlets->{$queue} = \@queues;
+ }
+ };
+}
sub lifecycle_report {'incident_reports'}
sub lifecycle_incident {'incidents'}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list