[Rt-commit] rt branch, 4.2/upgrade-from-3.8-errors, created. rt-4.1.23-4-g2adb0fa

Alex Vandiver alexmv at bestpractical.com
Thu Sep 5 12:40:52 EDT 2013


The branch, 4.2/upgrade-from-3.8-errors has been created
        at  2adb0fa77629629ef9799573137c1c655e346828 (commit)

- Log -----------------------------------------------------------------
commit 4934c45351e281ead2e69719cf04989645e5e7bd
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Sep 5 12:33:27 2013 -0400

    Switch the @ACL upgrade (which uses LoadSystemInternalGroup) to a sub
    
    The LoadSystemInternalGroup which would be used believes that the 4.1.13
    upgrade steps have already been run.  Obviously, they have not, leading
    to failure to find the Privileged group.  Side-step this and use a
    subroutine (which also must use DBIx::SearchBuilder::Record::LoadByCols,
    or emit well-meaning warnings) to find the group and add the ACL.

diff --git a/etc/upgrade/3.8.2/content b/etc/upgrade/3.8.2/content
index 0b60b51..36d0b7e 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -27,11 +27,24 @@ our @Initial = (
         }
         return 1;
     },
-);
-our @ACL = (
-    { GroupDomain => 'SystemInternal',
-      GroupType => 'privileged',
-      Right  => 'ShowApprovalsTab', },
+
+    sub {
+        my $group = RT::Group->new( RT->SystemUser );
+        $group->DBIx::SearchBuilder::Record::LoadByCols(
+            Domain => 'SystemInternal',
+            Type   => 'Privileged',
+        );
+        unless ($group->id) {
+            RT->Logger->warn("Failed to load Privilged group");
+            return;
+        }
+        my ( $return, $msg ) = $group->PrincipalObj->GrantRight(
+            Right => 'ShowApprovalsTab',
+            Object => RT->System,
+        );
+        RT->Logger->warn("Failed to grant ShowApprovalsTab right: $msg")
+            unless $return;
+    },
 );
 
 our @Templates = (

commit 2ec9a53944bdadd22644968364943698fa1058f7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Sep 5 12:36:17 2013 -0400

    Ensure that Scrip limits do not assume the current schema
    
    LimitToQueue in 4.2 uses the ObjectScrips table, which does not exist as
    of the 3.8.2 upgrade step.  Use the more specific Limit call to get the
    RT 3.8 functionality.  Also, ensure that RT::Scrips does not attempt to
    add a Disabled limit, which also does not come into the schema until
    4.2.

diff --git a/etc/upgrade/3.8.2/content b/etc/upgrade/3.8.2/content
index 36d0b7e..ab433b6 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -185,7 +185,8 @@ our @Final = (
         require Data::Dumper;
 
         my $scrips = RT::Scrips->new( RT->SystemUser );
-        $scrips->LimitToQueue( $approvals_q->id );
+        $scrips->{'with_disabled_column'} = 0;
+        $scrips->Limit( FIELD => 'Queue', VALUE => $approvals_q->id );
         while ( my $scrip = $scrips->Next ) {
             my %tmp =
                 map { $_ => $scrip->_Value( $_ ) }

commit 9c42e55e15ca740db7cb258e68039b45b8db9b0b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Sep 5 12:39:08 2013 -0400

    Enumerate the relevant columns from the schema at the time
    
    The current schema may have different columns, some of which did not
    exist at the time.  Hard-code the set of relevant columns which existed
    at the time.

diff --git a/etc/upgrade/3.8.2/content b/etc/upgrade/3.8.2/content
index ab433b6..bfb5515 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -190,7 +190,9 @@ our @Final = (
         while ( my $scrip = $scrips->Next ) {
             my %tmp =
                 map { $_ => $scrip->_Value( $_ ) }
-                $scrip->ReadableAttributes;
+                qw/id Description ScripCondition ScripAction
+                   CustomIsApplicableCode CustomPrepareCode CustomCommitCode
+                   Stage Queue Template Creator Created LastUpdatedBy LastUpdated/;
 
             print $tmp_fh Data::Dumper::Dumper( \%tmp );
 

commit 2adb0fa77629629ef9799573137c1c655e346828
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Sep 5 12:39:18 2013 -0400

    Side-step the ObjectScrips code now found in RT::Scrip::Delete
    
    The current code in RT::Scrip::Delete attempts to clean out records in
    ObjectScrips -- a table which does not exist yet as of RT 3.8.3.  Step
    around this by calling the DBIx::SearchBuilder::Record version of the
    method.

diff --git a/etc/upgrade/3.8.2/content b/etc/upgrade/3.8.2/content
index bfb5515..572e343 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -196,7 +196,7 @@ our @Final = (
 
             print $tmp_fh Data::Dumper::Dumper( \%tmp );
 
-            my ($status, $msg) = $scrip->Delete;
+            my ($status, $msg) = $scrip->DBIx::SearchBuilder::Record::Delete;
             unless ( $status ) {
                 RT->Logger->error( "Couldn't delete scrip: $msg");
             }

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


More information about the Rt-commit mailing list