summaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastermain/management
diff options
context:
space:
mode:
authorbrian avery <avery.brian@gmail.com>2015-09-14 16:45:40 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-18 09:04:24 +0100
commita065f7e5e9c07dbd71a98e7db1d7f711607716f3 (patch)
treea741d0f65b6a891b33ebd4a29879864eb1520b38 /lib/toaster/toastermain/management
parent2eb934814179ccf42e3d424dabe26b17d013a7ed (diff)
downloadbitbake-a065f7e5e9c07dbd71a98e7db1d7f711607716f3.tar.gz
toaster: delete multiple builds cleanup
This patch cleans up the multiple delete. It: 1) skips build id's that don't exist rather than giving a traceback. 2) let you pass in the ids as a space separated list 3) fixes the usage to match the space separated list format [YOCTO #7726] Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/toastermain/management')
-rw-r--r--lib/toaster/toastermain/management/commands/builddelete.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/toaster/toastermain/management/commands/builddelete.py b/lib/toaster/toastermain/management/commands/builddelete.py
index 343d3114c..ff93e549d 100644
--- a/lib/toaster/toastermain/management/commands/builddelete.py
+++ b/lib/toaster/toastermain/management/commands/builddelete.py
@@ -1,4 +1,5 @@
from django.core.management.base import BaseCommand, CommandError
+from django.core.exceptions import ObjectDoesNotExist
from orm.models import Build
from django.db import OperationalError
import os
@@ -6,12 +7,16 @@ import os
class Command(BaseCommand):
- args = "buildId"
+ args = '<buildID1 buildID2 .....>'
help = "Deletes selected build(s)"
- def handle(self, buildId, *args, **options):
- for bid in buildId.split(","):
- b = Build.objects.get(pk = bid)
+ def handle(self, *args, **options):
+ for bid in args:
+ try:
+ b = Build.objects.get(pk = bid)
+ except ObjectDoesNotExist:
+ print 'build %s does not exist, skipping...' %(bid)
+ continue
# theoretically, just b.delete() would suffice
# however SQLite runs into problems when you try to
# delete too many rows at once, so we delete some direct