def get(self, now=None): """Auto-promote updates that have been on a previous track for N days.""" promotions = {} for track in [common.TESTING, common.STABLE]: for p in models.AppleSUSProduct.all().filter('tracks !=', track): if track in p.tracks: continue # Datastore indexes may not be up to date... if not self._ReadyToAutoPromote(p, track, now): continue logging.info('AppleSUSProduct being promoted to %s: %s %s', track, p.product_id, p.name) p.tracks.append(track) p.put() if track not in promotions: promotions[track] = [] promotions[track].append(p) if track in promotions: applesus.GenerateAppleSUSCatalogs(track) models.AdminAppleSUSProductLog.Log( promotions[track], 'auto-promote to %s' % track) if promotions: self._NotifyAdminsOfAutoPromotions(promotions)
def _RegenerateCatalogs(self): """Regenerates specified Apple SUS catalogs.""" tracks = self.request.get_all('tracks') if tracks: applesus.GenerateAppleSUSCatalogs(tracks=tracks, delay=1) self.redirect('/admin/applesus?msg=Catalog regeneration in progress.') else: self.redirect('/admin/applesus?msg=Select at least one catalog!')