← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/pcj-better-oops into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/pcj-better-oops into lp:launchpad.

Commit message:
Include the package name in package copy job OOPS reports and emails.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1618133 in Launchpad itself: "Package copy OOPS emails should report package source names if present"
  https://bugs.launchpad.net/launchpad/+bug/1618133

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/pcj-better-oops/+merge/308612
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/pcj-better-oops into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/packagecopyjob.py'
--- lib/lp/soyuz/model/packagecopyjob.py	2015-07-09 20:06:17 +0000
+++ lib/lp/soyuz/model/packagecopyjob.py	2016-10-17 09:16:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -229,6 +229,7 @@
             ('source_archive_id', self.context.source_archive_id),
             ('target_archive_id', self.context.target_archive_id),
             ('target_distroseries_id', self.context.target_distroseries_id),
+            ('package_name', self.context.package_name),
             ('package_copy_job_id', self.context.id),
             ('package_copy_job_type', self.context.job_type.title),
             ])
@@ -236,7 +237,7 @@
 
     def getOperationDescription(self):
         """See `IPlainPackageCopyJob`."""
-        return "copying a package"
+        return "copying package %s" % self.context.package_name
 
     def getErrorRecipients(self):
         """See `IPlainPackageCopyJob`."""

=== modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py'
--- lib/lp/soyuz/tests/test_packagecopyjob.py	2015-09-03 15:14:07 +0000
+++ lib/lp/soyuz/tests/test_packagecopyjob.py	2016-10-17 09:16:59 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for sync package jobs."""
@@ -560,11 +560,25 @@
         self.assertIn(('source_archive_id', archive1.id), oops_vars)
         self.assertIn(('target_archive_id', archive2.id), oops_vars)
         self.assertIn(('target_distroseries_id', distroseries.id), oops_vars)
+        self.assertIn(('package_name', 'foo'), oops_vars)
         self.assertIn(('package_copy_job_id', naked_job.context.id), oops_vars)
         self.assertIn(
             ('package_copy_job_type', naked_job.context.job_type.title),
             oops_vars)
 
+    def test_getOperationDescription(self):
+        distroseries = self.factory.makeDistroSeries()
+        archive1 = self.factory.makeArchive(distroseries.distribution)
+        archive2 = self.factory.makeArchive(distroseries.distribution)
+        requester = self.factory.makePerson()
+        job = getUtility(IPlainPackageCopyJobSource).create(
+            package_name="foo", source_archive=archive1,
+            target_archive=archive2, target_distroseries=distroseries,
+            target_pocket=PackagePublishingPocket.RELEASE,
+            package_version="1.0-1", include_binaries=False,
+            requester=requester)
+        self.assertEqual("copying package foo", job.getOperationDescription())
+
     def test_smoke(self):
         archive1 = self.factory.makeArchive(self.distroseries.distribution)
         archive2 = self.factory.makeArchive(self.distroseries.distribution)


Follow ups