From 76e28e03258e438c1adf21785c3e0679491e464e Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 10 Nov 2022 11:36:30 +0100 Subject: [PATCH] PBSClient: file_restore_list: add extraParams and use timeout 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 --- src/PVE/PBSClient.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index d7dd6e1..ec05a1c 100644 --- a/src/PVE/PBSClient.pm +++ b/src/PVE/PBSClient.pm @@ -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,