mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
f0ef65b8e8
commit
a6dcab8110
@ -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).\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user