~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to cronscripts/expire-bugtasks.py

  • Committer: Deryck Hodge
  • Date: 2010-10-21 16:56:43 UTC
  • mto: This revision was merged to the branch mainline in revision 11846.
  • Revision ID: deryck.hodge@canonical.com-20101021165643-m0272b7yuaagv43t
Allow limiting to ubuntu via the bugtask expiry script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
import _pythonpath
17
17
 
 
18
from zope.component import getUtility
 
19
 
18
20
from canonical.config import config
19
21
from lp.services.scripts.base import LaunchpadCronScript
20
22
from lp.bugs.scripts.bugexpire import BugJanitor
40
42
 
41
43
    def main(self):
42
44
        """Run the BugJanitor."""
43
 
        janitor = BugJanitor(log=self.logger)
 
45
        target = None
 
46
        if self.options.ubuntu:
 
47
            # Avoid circular import.
 
48
            from lp.registry.interfaces.distribution import IDistributionSet
 
49
            target = getUtility(IDistributionSet).getByName('ubuntu')
 
50
        janitor = BugJanitor(log=self.logger, target=target)
44
51
        janitor.expireBugTasks(self.txn)
45
52
 
46
53