do_raw_client_cmd gains a parameter which it calls instead of run_command at the end. While at it, rename it to run_raw_client_cmd, as the current run_raw_client_cmd simply calls do_raw_client_cmd anyway.
Signed-off-by: Stefan Reiter <s.rei...@proxmox.com> --- src/PVE/PBSClient.pm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm index c3bfab7..f6b46b2 100644 --- a/src/PVE/PBSClient.pm +++ b/src/PVE/PBSClient.pm @@ -134,7 +134,7 @@ my $USE_CRYPT_PARAMS = { 'upload-log' => 1, }; -my sub do_raw_client_cmd { +my sub run_raw_client_cmd { my ($self, $client_cmd, $param, %opts) = @_; my $use_crypto = $USE_CRYPT_PARAMS->{$client_cmd}; @@ -185,12 +185,11 @@ my sub do_raw_client_cmd { $logfunc->("run: " . join(' ', @$cmd)); } - run_command($cmd, %opts); -} - -my sub run_raw_client_cmd { - my ($self, $client_cmd, $param, %opts) = @_; - return do_raw_client_cmd($self, $client_cmd, $param, %opts); + if(my $startcmd = delete $opts{startcmd}) { + return $startcmd->($cmd, %opts); + } else { + return run_command($cmd, %opts); + } } my sub run_client_cmd { @@ -206,7 +205,7 @@ my sub run_client_cmd { $param = [@$param, '--output-format=json'] if !$no_output; - do_raw_client_cmd( + run_raw_client_cmd( $self, $client_cmd, $param, -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel