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:
Jeremy Grossmann 2026-05-02 22:07:34 +08:00 committed by GitHub
commit 165209ba24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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).\