← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-ids-base-image-copy into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-ids-base-image-copy into launchpad:master.

Commit message:
Grant initializedistroseries access to insert PocketChroot rows

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1925788 in Launchpad itself: "InitializeDistroSeriesJob crashed on "Copying base images from parents""
  https://bugs.launchpad.net/launchpad/+bug/1925788

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/401695

The tests were previously running as the wrong database user, so we missed this permissions problem.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-ids-base-image-copy into launchpad:master.
diff --git a/database/schema/security.cfg b/database/schema/security.cfg
index 5da2031..bf9a9d3 100644
--- a/database/schema/security.cfg
+++ b/database/schema/security.cfg
@@ -1114,7 +1114,7 @@ public.packageuploadbuild                       = SELECT
 public.packageuploadcustom                      = SELECT, INSERT
 public.packaging                                = SELECT, INSERT
 public.person                                   = SELECT
-public.pocketchroot                             = SELECT
+public.pocketchroot                             = SELECT, INSERT
 public.processor                                = SELECT
 public.publisherconfig                          = SELECT
 public.section                                  = SELECT
diff --git a/lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py b/lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py
index 3acddf6..7071e6f 100644
--- a/lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py
+++ b/lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py
@@ -57,6 +57,7 @@ from lp.soyuz.scripts.initialize_distroseries import (
     InitializeDistroSeries,
     )
 from lp.testing import TestCaseWithFactory
+from lp.testing.dbuser import dbuser
 from lp.testing.layers import LaunchpadZopelessLayer
 
 
@@ -142,14 +143,15 @@ class InitializationHelperTestCase(TestCaseWithFactory):
         pub_config = publisherconfigset.getByDistribution(child.distribution)
         if pub_config is None:
             self.factory.makePublisherConfig(distribution=child.distribution)
-        ids = InitializeDistroSeries(
-            child, [parent.id for parent in parents], arches=arches,
-            archindep_archtag=archindep_archtag,
-            packagesets=packagesets, rebuild=rebuild, overlays=overlays,
-            overlay_pockets=overlay_pockets,
-            overlay_components=overlay_components)
-        ids.check()
-        ids.initialize()
+        with dbuser('initializedistroseries'):
+            ids = InitializeDistroSeries(
+                child, [parent.id for parent in parents], arches=arches,
+                archindep_archtag=archindep_archtag,
+                packagesets=packagesets, rebuild=rebuild, overlays=overlays,
+                overlay_pockets=overlay_pockets,
+                overlay_components=overlay_components)
+            ids.check()
+            ids.initialize()
         return child
 
     def createPackageInPackageset(self, distroseries, package_name,