]> git.proxmox.com Git - proxmox-backup.git/commitdiff
client: adapt to change datastroe status return schema
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 28 Oct 2020 21:59:39 +0000 (22:59 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 28 Oct 2020 21:59:40 +0000 (22:59 +0100)
fixes commit 16f9f244cfc19f021afa193929f40441434f0349 which extended
the return schema of the status API but did not adapted the client
status command to that.

Simply define our own tiny return schema and use that.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/bin/proxmox-backup-client.rs

index 4bb05bd14b50be78dbeb1f91a9f2ba51da7357cf..beaa935e8ac4cb0d697959634cf5b54befa56be0 100644 (file)
@@ -1657,7 +1657,10 @@ async fn prune_async(mut param: Value) -> Result<Value, Error> {
                optional: true,
            },
        }
-   }
+   },
+    returns: {
+        type: StorageStatus,
+    },
 )]
 /// Get repository status.
 async fn status(param: Value) -> Result<Value, Error> {
@@ -1671,7 +1674,7 @@ async fn status(param: Value) -> Result<Value, Error> {
     let path = format!("api2/json/admin/datastore/{}/status", repo.store());
 
     let mut result = client.get(&path, None).await?;
-    let mut data = result["data"].take();
+    let mut data = result["data"]["storage"].take();
 
     record_repository(&repo);
 
@@ -1690,7 +1693,7 @@ async fn status(param: Value) -> Result<Value, Error> {
         .column(ColumnConfig::new("used").renderer(render_total_percentage))
         .column(ColumnConfig::new("avail").renderer(render_total_percentage));
 
-    let schema = &proxmox_backup::api2::admin::datastore::API_RETURN_SCHEMA_STATUS;
+    let schema = &API_RETURN_SCHEMA_STATUS;
 
     format_and_print_result_full(&mut data, schema, &output_format, &options);