From 083cf87c8955eae4a2071e15baafd8a28c7fbd13 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Fri, 16 Aug 2024 10:54:22 -0700 Subject: [PATCH] Fix UWS Availability during errors The syntax for creating a UWS Availability model was incorrect: the field is notes, not note, and it takes an array of strings. --- changelog.d/20240816_105321_rra_DM_45818.md | 3 +++ safir/src/safir/uws/_storage.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelog.d/20240816_105321_rra_DM_45818.md diff --git a/changelog.d/20240816_105321_rra_DM_45818.md b/changelog.d/20240816_105321_rra_DM_45818.md new file mode 100644 index 00000000..15d9238c --- /dev/null +++ b/changelog.d/20240816_105321_rra_DM_45818.md @@ -0,0 +1,3 @@ +### Bug fixes + +- Fix construction of an `Availability` object reporting problems with the UWS database layer to use the correct field names and data type for the model. diff --git a/safir/src/safir/uws/_storage.py b/safir/src/safir/uws/_storage.py index f494dfe6..505e372d 100644 --- a/safir/src/safir/uws/_storage.py +++ b/safir/src/safir/uws/_storage.py @@ -163,10 +163,10 @@ async def availability(self) -> Availability: return Availability(available=True) except OperationalError: note = "cannot query UWS job database" - return Availability(available=False, note=note) + return Availability(available=False, notes=[note]) except Exception as e: note = f"{type(e).__name__}: {e!s}" - return Availability(available=False, note=note) + return Availability(available=False, notes=[note]) async def delete(self, job_id: str) -> None: """Delete a job by ID."""