Trees | Indices | Help |
---|
|
1 # $Id: $ 2 # This program is free software; you can redistribute it and/or modify 3 # it under the terms of the GNU General Public License as published by 4 # the Free Software Foundation; version 2 of the License. 5 # 6 # This program is distributed in the hope that it will be useful, 7 # but WITHOUT ANY WARRANTY; without even the implied warranty of 8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 # GNU Library General Public License for more details. 10 # 11 # You should have received a copy of the GNU General Public License 12 # along with this program; if not, write to the Free Software 13 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 14 15 """ 16 This module is for functions that are to be executed on a regular basis 17 using the TurboGears scheduler. 18 """ 19 20 import os 21 import shutil 22 import logging 23 import datetime 24 25 from os.path import isdir, realpath, dirname, join, islink 26 from turbogears import scheduler, config 27 28 from bodhi import mail 29 from bodhi.util import get_age_in_days 30 from bodhi.model import Release, PackageUpdate 31 32 log = logging.getLogger(__name__) 3335 """ 36 Clean up our mashed_dir, removing all referenced repositories 37 """ 38 log.info("Starting clean_repo job") 39 liverepos = [] 40 repos = config.get('mashed_dir') 41 for release in [rel.name.lower() for rel in Release.select()]: 42 for repo in [release + '-updates', release + '-updates-testing']: 43 liverepos.append(dirname(realpath(join(repos, repo)))) 44 for repo in [join(repos, repo) for repo in os.listdir(repos)]: 45 if not islink(repo) and isdir(repo): 46 fullpath = realpath(repo) 47 if fullpath not in liverepos: 48 log.info("Removing %s" % fullpath) 49 shutil.rmtree(fullpath)5052 # Nag submitters when their update has been sitting in testing for more 53 # than two weeks. 54 for update in PackageUpdate.select(PackageUpdate.q.status == 'testing'): 55 if get_age_in_days(update.date_pushed) > 14: 56 log.info("Nagging %s about testing update %s" % (update.submitter, 57 update.title)) 58 mail.send(update.submitter, 'old_testing', update)59 60 # Nag submitters if their update has been sitting unsubmitted in a pending 61 # state for longer than a week. 62 # TODO: implement this once the current 'pending' situation is under 63 # control. Right now, with our production instance, unpushed updates go 64 # back into this state -- and we don't want to nag about those. 6567 """ Schedule our periodic tasks """ 68 69 # Weekly repository cleanup 70 scheduler.add_interval_task(action=clean_repo, 71 taskname='Repository Cleanup', 72 initialdelay=0, 73 interval=604800) 74 75 # Weekly nagmail 76 scheduler.add_interval_task(action=nagmail, 77 taskname='Nagmail', 78 initialdelay=604800, 79 interval=604800)80
Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Sun Sep 23 14:46:39 2007 | http://epydoc.sourceforge.net |