[request-tracker-maintainers] Bug#773343: request-tracker4: fails to upgrade from 'wheezy' if rt4-extension-assettracker is installed

Niko Tyni ntyni at debian.org
Sat Dec 27 17:27:03 UTC 2014


(Chiming in, but please note that I don't consider myself much of an RT
maintainer anymore even if I'm still listed in Uploaders.)

On Thu, Dec 25, 2014 at 02:35:42PM +0900, Satoru KURASHIKI wrote:

> a. implement some migration from assettracker to RTx::Assets (but
> refered as too late in #748737)
> b. patch RT's db migration script to allow assettracker's modification
> c. purge assettracker with its data dump and recover RTDB before upgrading RT
> d. skip RT upgrade if assettracker is installed
> e. etc, etc.

c) seems rather destructive, I don't think we can/should do that
automatically. d) would be OK but I'm not sure if dbconfig-common can
be told to do that. However, b) actually seems attainable. See below.

The problem seems to be that the RTx::AssetTracker setup accidentally
inserts two almost identical sets of system role groups, and those
violate uniqueness constraints during the upgrade. From a database dump
diff after installing rt4-extension-assettracker on wheezy:

+INSERT INTO "Groups" VALUES(22,NULL,NULL,'RTx::AssetTracker::System-Role','Admin',0,1,'2014-12-26 15:05:46',1,'2014-12-26 15:05:46');
+INSERT INTO "Groups" VALUES(23,NULL,NULL,'RTx::AssetTracker::System-Role','Owner',0,1,'2014-12-26 15:05:46',1,'2014-12-26 15:05:46');
+INSERT INTO "Groups" VALUES(24,'','SystemRolegroup for internal use','RTx::AssetTracker::System-Role','Owner',0,1,'2014-12-26 15:05:46',1,'2014-12-26 15:05:46');
+INSERT INTO "Groups" VALUES(25,'','Pseudogroup for internal use','RTx::AssetTracker::System-Role','Admin',0,1,'2014-12-26 15:05:46',1,'2014-12-26 15:05:46');

The database initialization code installed as
 /usr/share/request-tracker4/plugins/RTx-AssetTracker/etc/initialdata
explicitly inserts the latter ones, but the 'use RTx::AssetTracker'
declaration gets run before that. This calls
 RTx::AssetTracker::Type->ConfigureRoles()
which ends up creating the first two groups around
 lib/RTx/AssetTracker/Type_Overlay.pm:153
because they don't exist yet.

The smallest database change I can think of to fix the problem is
something like
 UPDATE Groups set Instance=1 WHERE Domain='RTx::AssetTracker::System-Role' AND Description IS Null;
which could presumably be dropped into the request-tracker4 dbconfig-common
upgrade directories. I'd expect it to complete as a no-op on systems
without RTx::AssetTracker installed.

Disclaimer: I don't really know what the 'Instance' field is used for,
and the above change could well break RTx::AssetTracker or even RT
itself. I've only tested that it allows the request-tracker4 upgrade to
complete successfully with the (default) SQLite backend.  Testing with
Pg/mysql would be good too, as the 'Description IS Null' part feels a
bit fragile to me.

On a related note, does the wheezy RTx::AssetTracker even work with the
jessie RT? If it doesn't, a Breaks: entry would probably be warranted.
-- 
Niko Tyni   ntyni at debian.org



More information about the pkg-request-tracker-maintainers mailing list