From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id BCB217D27F; Wed, 20 Jul 2022 13:00:27 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7199B335AF; Wed, 20 Jul 2022 12:59:57 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS; Wed, 20 Jul 2022 12:59:55 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 58C3F43665; Wed, 20 Jul 2022 12:59:53 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com, pmg-devel@lists.proxmox.com Date: Wed, 20 Jul 2022 12:59:47 +0200 Message-Id: <20220720105948.291740-8-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220720105948.291740-1-f.ebner@proxmox.com> References: <20220720105948.291740-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.041 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [RFC/PATCH pmg-api 2/2] api: pbs: don't use namespaced parameters X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2022 11:00:27 -0000 Instead, rely on PBSClient to set namespace according to the initial configuration. Signed-off-by: Fabian Ebner --- Dependency bump for new libpve-common-perl needed. src/PMG/API2/PBS/Job.pm | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/PMG/API2/PBS/Job.pm b/src/PMG/API2/PBS/Job.pm index be9cc06..e49753c 100644 --- a/src/PMG/API2/PBS/Job.pm +++ b/src/PMG/API2/PBS/Job.pm @@ -19,14 +19,6 @@ use PMG::PBSSchedule; use base qw(PVE::RESTHandler); -my sub get_namespace : prototype($) { - my ($remote_config) = @_; - if (my $ns = $remote_config->{namespace}) { - return $ns if length($ns); # don't pass root namespace - } - return undef; -} - __PACKAGE__->register_method ({ name => 'list', path => '', @@ -111,10 +103,9 @@ my sub get_snapshots { my $res = []; return $res if $remote_config->{disable}; - my $namespace = get_namespace($remote_config); my $pbs = PVE::PBSClient->new($remote_config, $remote, $conf->{secret_dir}); - my $snapshots = $pbs->get_snapshots([$namespace, $group]); + my $snapshots = $pbs->get_snapshots($group); foreach my $item (@$snapshots) { my ($type, $id, $time) = $item->@{qw(backup-type backup-id backup-time)}; next if $type ne 'host'; @@ -252,9 +243,8 @@ __PACKAGE__->register_method ({ die "PBS remote '$remote' is disabled\n" if $remote_config->{disable}; my $pbs = PVE::PBSClient->new($remote_config, $remote, $conf->{secret_dir}); - my $namespace = get_namespace($remote_config); - eval { $pbs->forget_snapshot([$namespace, "host/$id/$time"]) }; + eval { $pbs->forget_snapshot("host/$id/$time") }; die "Forgetting backup failed: $@" if $@; return; @@ -324,13 +314,11 @@ __PACKAGE__->register_method ({ $log->("starting update of current backup state"); - my $namespace = get_namespace($remote_config); - eval { -d $backup_dir || mkdir $backup_dir; PMG::Backup::pmg_backup($backup_dir, $param->{statistic}); - $pbs->backup_fs_tree($backup_dir, $node, 'pmgbackup', undef, $namespace); + $pbs->backup_fs_tree($backup_dir, $node, 'pmgbackup'); rmtree $backup_dir; }; @@ -345,7 +333,7 @@ __PACKAGE__->register_method ({ my $group = "host/$node"; if (defined(my $prune_opts = $conf->prune_options($remote))) { $log->("starting prune of $group"); - my $res = eval { $pbs->prune_group(undef, $prune_opts, [$namespace, $group]) }; + my $res = eval { $pbs->prune_group(undef, $prune_opts, $group) }; if (my $err = $@) { $log->($err); PMG::Backup::send_backup_notification($notify, $remote, $full_log, $err); -- 2.30.2