Merge lp:~wgrant/launchpad/deleted-copies-are-not-ppas into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 18214
Proposed branch: lp:~wgrant/launchpad/deleted-copies-are-not-ppas
Merge into: lp:launchpad
Diff against target: 42 lines (+11/-7)
2 files modified
lib/lp/archivepublisher/tests/test_publisher.py (+9/-7)
lib/lp/registry/model/distribution.py (+2/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/deleted-copies-are-not-ppas
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+307427@code.launchpad.net

Commit message

Deleted copy archives aren't PPAs.

Description of the change

Deleted copy archives aren't PPAs.

Fixes PPA publisher OOPSes -- copy archives aren't deletable, and
they're on a different machine anyway.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
2--- lib/lp/archivepublisher/tests/test_publisher.py 2016-06-17 21:48:44 +0000
3+++ lib/lp/archivepublisher/tests/test_publisher.py 2016-10-03 13:11:39 +0000
4@@ -1289,16 +1289,18 @@
5 self.assertEqual(spiv.archive.id, pending_archive.id)
6
7 def testDeletingArchive(self):
8- # IArchiveSet.getPendingPPAs should return archives that have a
9+ # IArchiveSet.getPendingPPAs should include PPAs that have a
10 # status of DELETING.
11 ubuntu = getUtility(IDistributionSet)['ubuntu']
12
13- archive = self.factory.makeArchive()
14- old_num_pending_archives = ubuntu.getPendingPublicationPPAs().count()
15- archive.status = ArchiveStatus.DELETING
16- new_num_pending_archives = ubuntu.getPendingPublicationPPAs().count()
17- self.assertEqual(
18- 1 + old_num_pending_archives, new_num_pending_archives)
19+ ppa = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
20+ copy_archive = self.factory.makeArchive(purpose=ArchivePurpose.COPY)
21+ self.assertNotIn(ppa, ubuntu.getPendingPublicationPPAs())
22+ self.assertNotIn(copy_archive, ubuntu.getPendingPublicationPPAs())
23+ ppa.status = ArchiveStatus.DELETING
24+ copy_archive.status = ArchiveStatus.DELETING
25+ self.assertIn(ppa, ubuntu.getPendingPublicationPPAs())
26+ self.assertNotIn(copy_archive, ubuntu.getPendingPublicationPPAs())
27
28 def testPendingArchiveWithReapableFiles(self):
29 # getPendingPublicationPPAs returns archives that have reapable
30
31=== modified file 'lib/lp/registry/model/distribution.py'
32--- lib/lp/registry/model/distribution.py 2016-05-26 16:25:52 +0000
33+++ lib/lp/registry/model/distribution.py 2016-10-03 13:11:39 +0000
34@@ -1297,6 +1297,8 @@
35 orderBy=['archive.id'], distinct=True)
36
37 deleting_archives = Archive.selectBy(
38+ distribution=self,
39+ purpose=ArchivePurpose.PPA,
40 status=ArchiveStatus.DELETING).orderBy(['archive.id'])
41
42 return src_archives.union(bin_archives).union(