Skip to content

Commit

Permalink
fix: cherry-pick pr (update_app_resource 函数添加 metadata 校验 (#1544)) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
SheepSheepChen authored Aug 22, 2024
1 parent aa87a0b commit 8e92c27
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8e92c27

Please sign in to comment.