launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04336
[Merge] lp:~wgrant/launchpad/ppa-deletion-warnings into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/ppa-deletion-warnings into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/ppa-deletion-warnings/+merge/68804
Since publish-distro.py became a LaunchpadCronScript, logging at >= warning creates an OOPS. Deleting a PPA tries to delete the archive directory and its associated metadata directory, the latter of which will rarely exist. This branch suppresses a warning OOPS in that case by skipping the deletion if the directory does not exist.
--
https://code.launchpad.net/~wgrant/launchpad/ppa-deletion-warnings/+merge/68804
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/ppa-deletion-warnings into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py 2011-06-09 10:50:25 +0000
+++ lib/lp/archivepublisher/publishing.py 2011-07-22 08:37:16 +0000
@@ -636,6 +636,8 @@
self.archive.owner.name, self.archive.name, root_dir))
for directory in (root_dir, self._config.metaroot):
+ if not os.path.exists(directory):
+ continue
try:
shutil.rmtree(directory)
except (shutil.Error, OSError), e:
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py 2011-04-01 16:30:57 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py 2011-07-22 08:37:16 +0000
@@ -40,6 +40,7 @@
pocketsuffix,
)
from lp.registry.interfaces.series import SeriesStatus
+from lp.services.log.logger import BufferLogger
from lp.soyuz.enums import (
ArchivePurpose,
ArchiveStatus,
@@ -144,7 +145,8 @@
test_archive = getUtility(IArchiveSet).new(
distribution=self.ubuntutest, owner=ubuntu_team,
purpose=ArchivePurpose.PPA)
- publisher = getPublisher(test_archive, None, self.logger)
+ logger = BufferLogger()
+ publisher = getPublisher(test_archive, None, logger)
self.assertTrue(os.path.exists(publisher._config.archiveroot))
@@ -157,6 +159,8 @@
publisher._config.distroroot, test_archive.owner.name,
test_archive.name)
self.assertFalse(os.path.exists(root_dir))
+ self.assertNotIn('WARNING', logger.getLogBuffer())
+ self.assertNotIn('ERROR', logger.getLogBuffer())
def testPublishPartner(self):
"""Test that a partner package is published to the right place."""