[Rt-commit] [rtir] 01/01: Add upgrade step to fixup existing constituency queue lifecycles
Shawn Moore
shawn at bestpractical.com
Tue Feb 9 18:58:14 EST 2016
This is an automated email from the git hooks/post-receive script.
shawn pushed a commit to branch 3.4/upgrade-constituency-queue-lifecycle
in repository rtir.
commit 995398271072ceb09d72388979f01f43ab5bedc9
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Feb 9 23:54:56 2016 +0000
Add upgrade step to fixup existing constituency queue lifecycles
Previously they were all created with the default lifecycle. 3.4 uses
lifecycles more thoroughly, and all new constituency queues get the
proper lifecycles, so upgrade old queues to use lifecycles
On the off-chance anyone messed with the lifecycle of any constituency
queue we generate a warning but don't change anything, assuming the user
knows best.
Fixes: I#23573
---
etc/upgrade/3.3.4/content | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/etc/upgrade/3.3.4/content b/etc/upgrade/3.3.4/content
new file mode 100644
index 0000000..c45f25d
--- /dev/null
+++ b/etc/upgrade/3.3.4/content
@@ -0,0 +1,43 @@
+use strict;
+use warnings;
+
+our @Initial = (
+ sub {
+ my $queues = RT::Queues->new(RT->SystemUser);
+ $queues->UnLimit;
+ while (my $queue = $queues->Next) {
+ my $name = $queue->Name;
+ my $lifecycle;
+
+ if ($name =~ /^Incident Reports - /) {
+ $lifecycle = RT::IR->lifecycle_report;
+ }
+ elsif ($name =~ /^Incidents - /) {
+ $lifecycle = RT::IR->lifecycle_incident;
+ }
+ elsif ($name =~ /^Investigations - /) {
+ $lifecycle = RT::IR->lifecycle_investigation;
+ }
+ elsif ($name =~ /^Blocks - /) {
+ $lifecycle = RT::IR->lifecycle_countermeasure;
+ }
+ else {
+ next;
+ }
+
+ my $old_lifecycle = $queue->Lifecycle;
+
+ next if $old_lifecycle eq $lifecycle;
+
+ if ($old_lifecycle ne 'default') {
+ RT->Logger->warning( "Unwilling to change queue $name lifecycle from unexpected lifecycle of $old_lifecycle to $lifecycle. (expected lifecycle default)" );
+ next;
+ }
+
+ RT->Logger->debug( "Changing queue $name lifecycle from $old_lifecycle to $lifecycle" );
+
+ my ($ok, $msg) = $queue->SetLifecycle($lifecycle);
+ RT->Logger->error( "Unable to change queue $name lifecycle from $old_lifecycle to $lifecycle: $msg" ) if !$ok;
+ }
+ },
+);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list