mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-28 19:22:22 +02:00
Merge pull request #2698 from yueguobin/fix/compute-update-password-none-error
fix: avoid AttributeError when password is not provided in compute update
This commit is contained in:
commit
165209ba24
@ -69,7 +69,8 @@ class ComputesRepository(BaseRepository):
|
|||||||
async def update_compute(self, compute_id: UUID, compute_update: schemas.ComputeUpdate) -> Optional[models.Compute]:
|
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 = 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).\
|
query = update(models.Compute).\
|
||||||
where(models.Compute.compute_id == compute_id).\
|
where(models.Compute.compute_id == compute_id).\
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user