From 8e92c27b28eb632f79e388f61f5c9e29b655b98f Mon Sep 17 00:00:00 2001 From: tiga <68499559+SheepSheepChen@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:00:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20cherry-pick=20pr=20(update=5Fapp=5Fresou?= =?UTF-8?q?rce=20=E5=87=BD=E6=95=B0=E6=B7=BB=E5=8A=A0=20metadata=20?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=20(#1544))=20(#1554)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paas_wl/bk_app/cnative/specs/models/app_resource.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apiserver/paasng/paas_wl/bk_app/cnative/specs/models/app_resource.py b/apiserver/paasng/paas_wl/bk_app/cnative/specs/models/app_resource.py index 36b5dd0ce2..79ec0d1ac1 100644 --- a/apiserver/paasng/paas_wl/bk_app/cnative/specs/models/app_resource.py +++ b/apiserver/paasng/paas_wl/bk_app/cnative/specs/models/app_resource.py @@ -242,8 +242,11 @@ def update_app_resource(app: Application, module: Module, payload: Dict): :raise: `ValidationError` when payload is invalid :raise: `ValueError` if model resource has not been initialized for given application """ - # force replace metadata.name with app_code to avoid user modify - payload["metadata"]["name"] = generate_bkapp_name(module) + try: + # force replace metadata.name with app_code to avoid user modify + payload["metadata"]["name"] = generate_bkapp_name(module) + except KeyError as e: + raise ValidationError(f"Missing field in manifest: {e}") try: obj = BkAppResource(**payload)