[pdm-devel] [PATCH datacenter-manager 2/2] server: api: pbs: improve error message for datastore content
Dominik Csapak
d.csapak at proxmox.com
Fri Dec 5 12:04:54 CET 2025
the code here looks for the response code to determine what to do, but
since the 'extjs' formatter is used, that's always 200, so it's always
attempted to parse the body like a successful api call.
Change the api call to use the 'json' formatter, which correctly sets
the response code directly and not in the body.
This fixes an issue with a very non-informative error message when a pbs
datastore has an error (e.g. no '.chunks' folder) like
missing field `data` at line 1 column xy
instead of the actual error message from the api call.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
server/src/pbs_client.rs | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/server/src/pbs_client.rs b/server/src/pbs_client.rs
index f4f1f820..3f3d2b5f 100644
--- a/server/src/pbs_client.rs
+++ b/server/src/pbs_client.rs
@@ -185,10 +185,9 @@ impl PbsClient {
datastore: &str,
namespace: Option<&str>,
) -> Result<JsonRecords<pbs_api_types::SnapshotListItem>, anyhow::Error> {
- let path =
- ApiPathBuilder::new(format!("/api2/extjs/admin/datastore/{datastore}/snapshots"))
- .maybe_arg("ns", &namespace)
- .build();
+ let path = ApiPathBuilder::new(format!("/api2/json/admin/datastore/{datastore}/snapshots"))
+ .maybe_arg("ns", &namespace)
+ .build();
let response = self
.0
.streaming_request(http::Method::GET, &path, None::<()>)
--
2.47.3
More information about the pdm-devel
mailing list