From a6dcab81106e878bf3e053ccbd6ab8ae31e7c03b Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Thu, 30 Apr 2026 09:38:55 +0800 Subject: [PATCH] fix: avoid AttributeError when password is not provided in compute update When updating a compute without providing a password field, compute_update.password is None and calling .get_secret_value() on it causes a 500 Internal Server Error. Only set the password in update_values when a password is actually provided. Co-Authored-By: Claude Opus 4.6 --- gns3server/db/repositories/computes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gns3server/db/repositories/computes.py b/gns3server/db/repositories/computes.py index 6c6f0f930..181b92aa6 100644 --- a/gns3server/db/repositories/computes.py +++ b/gns3server/db/repositories/computes.py @@ -69,7 +69,8 @@ class ComputesRepository(BaseRepository): async def update_compute(self, compute_id: UUID, compute_update: schemas.ComputeUpdate) -> Optional[models.Compute]: update_values = compute_update.model_dump(exclude_unset=True) - update_values["password"] = compute_update.password.get_secret_value() + if compute_update.password is not None: + update_values["password"] = compute_update.password.get_secret_value() query = update(models.Compute).\ where(models.Compute.compute_id == compute_id).\