[pbs-devel] [RFC PATCH proxmox-backup 2/6] client: Add `--protected` CLI flag to backup command

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Jan 18 12:13:52 CET 2023


On January 18, 2023 11:48 am, Christoph Heiss wrote:
> Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
> ---
>  proxmox-backup-client/src/main.rs | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs
> index 55198108..ee09db83 100644
> --- a/proxmox-backup-client/src/main.rs
> +++ b/proxmox-backup-client/src/main.rs
> @@ -663,6 +663,12 @@ fn spawn_catalog_upload(
>                 optional: true,
>                 default: false,
>             },
> +           "protected": {
> +               type: Boolean,
> +               description: "Set backup as protected after upload.",
> +               optional: true,
> +               default: false,
> +           },
>         }
>     }
>  )]
> @@ -716,6 +722,7 @@ async fn create_backup(
> 
>      let empty = Vec::new();
>      let exclude_args = param["exclude"].as_array().unwrap_or(&empty);
> +    let protected = param["protected"].as_bool().unwrap_or(false);
> 
>      let mut pattern_list = Vec::with_capacity(exclude_args.len());
>      for entry in exclude_args {
> @@ -1082,7 +1089,9 @@ async fn create_backup(
>          .upload_blob_from_data(manifest.into_bytes(), MANIFEST_BLOB_NAME, options)
>          .await?;
> 
> -    client.finish().await?;
> +    client.finish(Some(json!({
> +        "protected": protected,
> +    }))).await?;

this fails the backup with new client + --protected, at the very end, if the
server doesn't have patch #1 of this series.

we need some sort of compat mechanism...

> 
>      let end_time = std::time::Instant::now();
>      let elapsed = end_time.duration_since(start_time);
> --
> 2.34.1
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 





More information about the pbs-devel mailing list