From patchwork Thu Jan 4 15:18:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 37353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 210ABC47073 for ; Thu, 4 Jan 2024 15:18:33 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.56261.1704381507770173488 for ; Thu, 04 Jan 2024 07:18:28 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=xRgqAb4V; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 7D5D49C15B5 for ; Thu, 4 Jan 2024 10:18:26 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id xugA8RjkCHUW; Thu, 4 Jan 2024 10:18:26 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 23C4A9C32E2; Thu, 4 Jan 2024 10:18:26 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 23C4A9C32E2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1704381506; bh=mBxSutm6wDEy840sgvQFFKQeV/wFP3BC9HwNNx2ixaI=; h=From:To:Date:Message-Id:MIME-Version; b=xRgqAb4V7uOxehch5ESJ99ebt+iSOaweBaF+1idX27D2aDx1ATP5kctVdhvKEyoUH ZqjobV757XCYRzq7/A6xMtpkDYftB6nEe++pyxuef5DI7nwqi8RZ5mHbkIKAnHcy2H KKI9RnviOzbaKb0mJJpo6Vmw0flwLzlvkTJELKWm5PcVhVojRbwNX25XWU8f6pNEex NS5jYSyt6B4IqyDydPuTQD0jhOO73vsUxd/hCquDuaqYNbhtvRF0s3wUQ/ZCFnCAS1 OsdmX1g8oXMtwVbcjmciEoHgeIEJj9wpX8XG0B61WfZeVqaIb1t6C2yF+6ZM8AOoNC BgOdrpPvK6YzQ== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id tycLTfLRxSaQ; Thu, 4 Jan 2024 10:18:26 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 412CE9C15B5; Thu, 4 Jan 2024 10:18:25 -0500 (EST) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH] toaster/toastergui: Bug-fix verify given layer path only if import/add local layer Date: Thu, 4 Jan 2024 16:18:18 +0100 Message-Id: <20240104151818.133335-1-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 04 Jan 2024 15:18:33 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/6123 Signed-off-by: Alassane Yattara --- lib/toaster/toastergui/api.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/toaster/toastergui/api.py b/lib/toaster/toastergui/api.py index a06ffc00..e367bd91 100644 --- a/lib/toaster/toastergui/api.py +++ b/lib/toaster/toastergui/api.py @@ -227,7 +227,7 @@ class XhrSetDefaultImageUrl(View): # same logical name # * Each project that uses a layer will have its own # 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 # then the Layer record is deleted to remove orphans # @@ -457,15 +457,18 @@ class XhrLayer(View): 'layerdetailurl': layer_dep.get_detailspage_url(project.pk)}) - # Scan the layer's content and update components - scan_layer_content(layer,layer_version) + # 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_layer_content(layer,layer_version) except Layer_Version.DoesNotExist: return error_response("layer-dep-not-found") except Project.DoesNotExist: return error_response("project-not-found") - except KeyError: - return error_response("incorrect-parameters") + except KeyError as e: + _log("KeyError: %s" % e) + return error_response(f"incorrect-parameters") return JsonResponse({'error': "ok", 'imported_layer': {