]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: delete recipe if it can't be saved
authorEd Bartosh <ed.bartosh@linux.intel.com>
Thu, 1 Oct 2015 21:19:56 +0000 (14:19 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 12 Oct 2015 13:37:50 +0000 (14:37 +0100)
Due to Recipe model constraints some recipes can't be
saved. However, they still can create incomplete records in
the database. This causes all sorts of errors when Toaster
operates with those objects. Removing them should fix those
issues.

[YOCTO #7969]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/toaster/orm/models.py

index 6c28726bd9cde8ed8df00575dcbc91262dd251b3..567732518a719e434e79d2b3f30968dabb366193 100644 (file)
@@ -1011,6 +1011,7 @@ class LayerIndexLayerSource(LayerSource):
                 ro.save()
             except IntegrityError as e:
                 logger.debug("Failed saving recipe, ignoring: %s (%s:%s)" % (e, ro.layer_version, ri['filepath']+"/"+ri['filename']))
+                ro.delete()
         if not connection.features.autocommits_when_autocommit_is_off:
             transaction.set_autocommit(True)