bitbake: toaster/toastergui: Bug-fix verify given layer path only if import/add local layer

(Bitbake rev: 380a9ac97de5774378ded5e37d40b79b96761a0c)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Alassane Yattara 2024-01-04 16:18:18 +01:00 committed by Steve Sakoman
parent cf9b37dfd0
commit 94b73c33d5

View File

@ -227,7 +227,7 @@ class XhrSetDefaultImageUrl(View):
# same logical name # same logical name
# * Each project that uses a layer will have its own # * Each project that uses a layer will have its own
# LayerVersion and Project Layer for it # LayerVersion and Project Layer for it
# * During the Paroject delete process, when the last # * During the Project delete process, when the last
# LayerVersion for a 'local_source_dir' layer is deleted # LayerVersion for a 'local_source_dir' layer is deleted
# then the Layer record is deleted to remove orphans # then the Layer record is deleted to remove orphans
# #
@ -457,6 +457,8 @@ class XhrLayer(View):
'layerdetailurl': 'layerdetailurl':
layer_dep.get_detailspage_url(project.pk)}) layer_dep.get_detailspage_url(project.pk)})
# Only scan_layer_content if layer is local
if layer_data.get('local_source_dir', None):
# Scan the layer's content and update components # Scan the layer's content and update components
scan_layer_content(layer,layer_version) scan_layer_content(layer,layer_version)
@ -464,8 +466,9 @@ class XhrLayer(View):
return error_response("layer-dep-not-found") return error_response("layer-dep-not-found")
except Project.DoesNotExist: except Project.DoesNotExist:
return error_response("project-not-found") return error_response("project-not-found")
except KeyError: except KeyError as e:
return error_response("incorrect-parameters") _log("KeyError: %s" % e)
return error_response(f"incorrect-parameters")
return JsonResponse({'error': "ok", return JsonResponse({'error': "ok",
'imported_layer': { 'imported_layer': {