[pve-devel] [PATCH v1 pve-common 04/18] pbsclient: pull variable out of long post-if definedness check

Max Carrara m.carrara at proxmox.com
Fri Aug 2 15:26:42 CEST 2024


Signed-off-by: Max Carrara <m.carrara at proxmox.com>
---
 src/PVE/PBSClient.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm
index 525b37f..ab1fa62 100644
--- a/src/PVE/PBSClient.pm
+++ b/src/PVE/PBSClient.pm
@@ -288,7 +288,9 @@ sub backup_fs_tree {
 
     $cmd_opts = {} if !defined($cmd_opts);
 
-    $cmd_opts->{namespace} = $self->{scfg}->{namespace} if defined($self->{scfg}->{namespace});
+    if (defined(my $namespace = $self->{scfg}->{namespace})) {
+	$cmd_opts->{namespace} = $namespace;
+    }
 
     return run_raw_client_cmd($self, 'backup', $param, %$cmd_opts);
 };
-- 
2.39.2





More information about the pve-devel mailing list