mirror of
https://git.yoctoproject.org/poky
synced 2026-04-29 09:32:11 +02:00
bitbake: toaster: improve exception handling
This patch improves exception handling, fixing issues as prompted by pylint, including exception renaming. (Bitbake rev: 652fad64864703cb1bbeede8d5bfc4208974be68) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
99730d64d4
commit
504396f6a3
@@ -269,11 +269,10 @@ class Project(models.Model):
|
||||
except ProjectVariable.DoesNotExist:
|
||||
pass
|
||||
br.save()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# revert the build request creation since we're not done cleanly
|
||||
br.delete()
|
||||
import sys
|
||||
et, ei, tb = sys.exc_info()
|
||||
raise type(e), e, tb
|
||||
raise
|
||||
return br
|
||||
|
||||
class Build(models.Model):
|
||||
@@ -364,7 +363,7 @@ class BuildArtifact(models.Model):
|
||||
|
||||
|
||||
def is_available(self):
|
||||
return build.buildrequest.environment.has_artifact(file_path)
|
||||
return self.build.buildrequest.environment.has_artifact(self.file_name)
|
||||
|
||||
class ProjectTarget(models.Model):
|
||||
project = models.ForeignKey(Project)
|
||||
@@ -981,12 +980,10 @@ class LayerIndexLayerSource(LayerSource):
|
||||
if 'inherits' in ri:
|
||||
ro.is_image = 'image' in ri['inherits'].split()
|
||||
ro.save()
|
||||
except:
|
||||
#print "Duplicate Recipe, ignoring: ", vars(ro)
|
||||
pass
|
||||
except Exception:
|
||||
logger.warning("Duplicate Recipe, ignoring: %s " % vars(ro))
|
||||
if not connection.features.autocommits_when_autocommit_is_off:
|
||||
transaction.set_autocommit(True)
|
||||
pass
|
||||
|
||||
class BitbakeVersion(models.Model):
|
||||
|
||||
|
||||
@@ -1876,10 +1876,7 @@ if True:
|
||||
|
||||
queryset = Build.objects.filter(outcome__lte = Build.IN_PROGRESS)
|
||||
|
||||
try:
|
||||
context, pagesize, orderby = _build_list_helper(request, queryset)
|
||||
except InvalidRequestException as e:
|
||||
raise RedirectException( builds, request.GET, e.response)
|
||||
context, pagesize, orderby = _build_list_helper(request, queryset)
|
||||
|
||||
_set_parameters_values(pagesize, orderby, request)
|
||||
return context
|
||||
@@ -2422,7 +2419,8 @@ if True:
|
||||
# dependency already (like modified on another page)
|
||||
try:
|
||||
prj_layer, prj_layer_created = ProjectLayer.objects.get_or_create(layercommit=layer_dep_obj, project=prj)
|
||||
except:
|
||||
except IntegrityError as e:
|
||||
logger.warning("Integrity error while saving Project Layers: %s (original %s)" % (e, e.__cause__))
|
||||
continue
|
||||
|
||||
if prj_layer_created:
|
||||
@@ -2639,10 +2637,7 @@ if True:
|
||||
|
||||
queryset = Build.objects.filter(outcome__lte = Build.IN_PROGRESS)
|
||||
|
||||
try:
|
||||
context, pagesize, orderby = _build_list_helper(request, queryset)
|
||||
except InvalidRequestException as e:
|
||||
raise RedirectException('projectbuilds', request.GET, e.response, pid = pid)
|
||||
context, pagesize, orderby = _build_list_helper(request, queryset)
|
||||
|
||||
context['project'] = prj
|
||||
_set_parameters_values(pagesize, orderby, request)
|
||||
|
||||
Reference in New Issue
Block a user