[pbs-devel] [PATCH proxmox-backup v3 5/5] proxmox-tape: inventory: add default to parameters

Dominik Csapak d.csapak at proxmox.com
Wed Oct 19 13:13:35 CEST 2022


and convert the 'Option<bool>' to 'bool'

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/bin/proxmox-tape.rs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/bin/proxmox-tape.rs b/src/bin/proxmox-tape.rs
index 3511507f..59254540 100644
--- a/src/bin/proxmox-tape.rs
+++ b/src/bin/proxmox-tape.rs
@@ -438,11 +438,13 @@ async fn read_label(mut param: Value) -> Result<(), Error> {
                 description: "Load unknown tapes and try read labels",
                 type: bool,
                 optional: true,
+                default: false,
             },
             "read-all-labels": {
                 description: "Load all tapes and try read labels (even if already inventoried)",
                 type: bool,
                 optional: true,
+                default: false,
             },
             "catalog": {
                 description: "Try to restore catalogs from tapes.",
@@ -455,8 +457,8 @@ async fn read_label(mut param: Value) -> Result<(), Error> {
 )]
 /// List (and update) media labels (Changer Inventory)
 async fn inventory(
-    read_labels: Option<bool>,
-    read_all_labels: Option<bool>,
+    read_labels: bool,
+    read_all_labels: bool,
     catalog: bool,
     mut param: Value,
 ) -> Result<(), Error> {
@@ -465,8 +467,7 @@ async fn inventory(
     let (config, _digest) = pbs_config::drive::config()?;
     let drive = extract_drive_name(&mut param, &config)?;
 
-    let read_all_labels = read_all_labels.unwrap_or(false);
-    let do_read = read_labels.unwrap_or(false) || read_all_labels || catalog;
+    let do_read = read_labels || read_all_labels || catalog;
 
     let client = connect_to_localhost()?;
 
-- 
2.30.2






More information about the pbs-devel mailing list