[pbs-devel] [PATCH v3 proxmox-backup 4/4] fix #2996: client: allow optional match patterns for restore

Gabriel Goller g.goller at proxmox.com
Thu Jun 13 14:28:34 CEST 2024


On 13.06.2024 12:56, Christian Ebner wrote:
>diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
>index f1c7fbf93..9cc6f889a 100644
>--- a/proxmox-backup-client/src/main.rs
>+++ b/proxmox-backup-client/src/main.rs
>@@ -1389,6 +1389,10 @@ We do not extract '.pxar' archives when writing to standard output.
>
> "###
>             },
>+            pattern: {
>+                type: PathPatterns,
>+                optional: true,
>+            },
>             rate: {
>                 schema: TRAFFIC_CONTROL_RATE_SCHEMA,
>                 optional: true,
>@@ -1514,6 +1518,21 @@ async fn restore(
>     let target = json::required_string_param(&param, "target")?;
>     let target = if target == "-" { None } else { Some(target) };
>
>+    let mut match_list = Vec::new();
>+    if let Some(pattern) = param["pattern"].as_array() {
>+        if target.is_none() {
>+            bail!("matches not allowed when restoring to stdout");

s/matches/patterns

>+        }
>+
>+        for p in pattern {
>+            if let Some(pattern) = p.as_str() {
>+                let match_entry =
>+                    MatchEntry::parse_pattern(pattern, PatternFlag::PATH_NAME, MatchType::Include)?;
>+                match_list.push(match_entry);
>+            }
>+        }
>+    };
>+
>     let crypto = crypto_parameters(&param)?;
>
>     let crypt_config = match crypto.enc_key {

Otherwise the pattern-restore part seems to work nicely! Consider:

Tested-by: Gabriel Goller <g.goller at proxmox.com>





More information about the pbs-devel mailing list