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 9088D99B3A for ; Tue, 14 Nov 2023 14:00:17 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0A1CE1FE31 for ; Tue, 14 Nov 2023 14:00:16 +0100 (CET) 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 for ; Tue, 14 Nov 2023 14:00:14 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 90F5F42963 for ; Tue, 14 Nov 2023 14:00:14 +0100 (CET) From: Lukas Wagner To: pve-devel@lists.proxmox.com Date: Tue, 14 Nov 2023 13:59:37 +0100 Message-Id: <20231114130000.565122-30-l.wagner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231114130000.565122-1-l.wagner@proxmox.com> References: <20231114130000.565122-1-l.wagner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.012 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH v2 pve-manager 29/52] api: replication: adapt to matcher-based notification system X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2023 13:00:17 -0000 Signed-off-by: Lukas Wagner --- PVE/API2/Replication.pm | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/PVE/API2/Replication.pm b/PVE/API2/Replication.pm index d61518ba..0dc944c9 100644 --- a/PVE/API2/Replication.pm +++ b/PVE/API2/Replication.pm @@ -129,7 +129,7 @@ my sub _handle_job_err { # The replication job is run every 15 mins if no schedule is set. my $schedule = $job->{schedule} // '*/15'; - my $properties = { + my $template_data = { "failure-count" => $fail_count, "last-sync" => $jobstate->{last_sync}, "next-sync" => $next_sync, @@ -139,19 +139,18 @@ my sub _handle_job_err { "error" => $err, }; + my $metadata_fields = { + # TODO: Add job-id? + type => "replication", + }; + eval { - my $dcconf = PVE::Cluster::cfs_read_file('datacenter.cfg'); - my $target = $dcconf->{notify}->{'target-replication'} // PVE::Notify::default_target(); - my $notify = $dcconf->{notify}->{'replication'} // 'always'; - - if ($notify eq 'always') { - PVE::Notify::error( - $target, - $replication_error_subject_template, - $replication_error_body_template, - $properties - ); - } + PVE::Notify::error( + $replication_error_subject_template, + $replication_error_body_template, + $template_data, + $metadata_fields + ); }; warn ": $@" if $@; -- 2.39.2