]> git.proxmox.com Git - pve-common.git/commitdiff
PBSClient: file_restore_list: add extraParams and use timeout
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 10 Nov 2022 10:36:30 +0000 (11:36 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 15 Nov 2022 12:22:30 +0000 (13:22 +0100)
under some conditions, like when calling it in the api where we have
a 30s pveproxy limit, we want to make use of the '--timeout' parameter
of the file-restore binary, but we may want to call it in the future
where we don't want add timeout.

To achieve that, add an extendable 'extra_params' hash parameter to
'file_restore_list' and use the timeout from there.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/PBSClient.pm

index d7dd6e10756b1b51b14069609e9913aa56a55223..ec05a1cb70419c4e987cacc0c11145fedae98b5e 100644 (file)
@@ -375,14 +375,19 @@ sub status {
 };
 
 sub file_restore_list {
-    my ($self, $snapshot, $filepath, $base64) = @_;
+    my ($self, $snapshot, $filepath, $base64, $extra_params) = @_;
 
     (my $namespace, $snapshot) = split_namespaced_parameter($self, $snapshot);
+    my $cmd = [ $snapshot, $filepath, "--base64", $base64 ? 1 : 0];
+
+    if (my $timeout = $extra_params->{timeout}) {
+       push $cmd->@*, '--timeout', $timeout;
+    }
 
     return run_client_cmd(
        $self,
        "list",
-       [ $snapshot, $filepath, "--base64", $base64 ? 1 : 0 ],
+       $cmd,
        0,
        "proxmox-file-restore",
        $namespace,