public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH v3 proxmox-backup 4/4] fix #2996: client: allow optional match patterns for restore
Date: Thu, 13 Jun 2024 14:28:34 +0200	[thread overview]
Message-ID: <20240613122834.a6fyqwzryjg72fkl@luna.proxmox.com> (raw)
In-Reply-To: <20240613105605.283550-5-c.ebner@proxmox.com>

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@proxmox.com>



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  reply	other threads:[~2024-06-13 12:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 10:56 [pbs-devel] [PATCH v3 proxmox-backup 0/4] " Christian Ebner
2024-06-13 10:56 ` [pbs-devel] [PATCH v3 proxmox-backup 1/4] api-types: implement dedicated api type for match patterns Christian Ebner
2024-06-13 10:56 ` [pbs-devel] [PATCH v3 proxmox-backup 2/4] pxar: bin: use dedicated api type for restore pattern Christian Ebner
2024-06-13 10:56 ` [pbs-devel] [PATCH v3 proxmox-backup 3/4] client: catalog shell: use dedicated api type for patterns Christian Ebner
2024-06-13 10:56 ` [pbs-devel] [PATCH v3 proxmox-backup 4/4] fix #2996: client: allow optional match patterns for restore Christian Ebner
2024-06-13 12:28   ` Gabriel Goller [this message]
2024-06-13 12:59 ` [pbs-devel] [PATCH v3 proxmox-backup 0/4] " Christian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240613122834.a6fyqwzryjg72fkl@luna.proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal