rrs/tools/rrs_maintainer_history.py: Set new recipes to No maintainer if don't have

When add new recipes sometimes don't have maintainer defined causing
errors on frontend when search for one.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
This commit is contained in:
Aníbal Limón 2015-07-14 10:25:27 -05:00
parent abc3ba594f
commit 4f5d5a7784

View File

@ -148,6 +148,19 @@ def maintainer_history(logger):
utils.runcmd("git checkout master -f", pokypath, logger=logger)
utils.runcmd("git branch -D %s" % (branchname), pokypath, logger=logger)
# set new recipes to no maintainer if don't have one
m = Maintainer.objects.get(id = 0) # No Maintainer
rms = RecipeMaintainerHistory.get_last()
for recipe in Recipe.objects.all():
if not RecipeMaintainer.objects.filter(recipe = recipe, history = rms):
rm = RecipeMaintainer()
rm.recipe = recipe
rm.maintainer = m
rm.history = rms
rm.save()
logger.debug("%s: New recipe not found maintainer set to 'No maintainer'." % \
(recipe.pn))
transaction.commit()
transaction.leave_transaction_management()