From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager v2 3/4] notification: replication: add common properties to template data
Date: Fri, 28 Mar 2025 11:19:13 +0100 [thread overview]
Message-ID: <20250328101915.73951-5-l.wagner@proxmox.com> (raw)
In-Reply-To: <20250328101915.73951-1-l.wagner@proxmox.com>
The new PVE::Notify::common_template_data helper gives us a hash of
properties which should be available in all notifications (hostname,
fqdn, cluster-name at this moment). This commit makes sure that
replication notifications have these available.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
PVE/API2/Replication.pm | 16 +++++++---------
templates/default/replication-body.txt.hbs | 2 +-
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/PVE/API2/Replication.pm b/PVE/API2/Replication.pm
index e4a7180f..3a2be73a 100644
--- a/PVE/API2/Replication.pm
+++ b/PVE/API2/Replication.pm
@@ -112,15 +112,13 @@ my sub _handle_job_err {
# The replication job is run every 15 mins if no schedule is set.
my $schedule = $job->{schedule} // '*/15';
- my $template_data = {
- "failure-count" => $fail_count,
- "last-sync" => $jobstate->{last_sync},
- "next-sync" => $next_sync,
- "job-id" => $job->{id},
- "job-target" => $job->{target},
- "job-schedule" => $schedule,
- "error" => $err,
- };
+ my $template_data = PVE::Notify::common_template_data();
+ $template_data->{"failure-count"} = $fail_count;
+ $template_data->{"last-sync"} = $jobstate->{last_sync};
+ $template_data->{"job-id"} = $job->{id};
+ $template_data->{"job-target"} = $job->{target};
+ $template_data->{"job-schedule"} = $schedule;
+ $template_data->{"error"} = $err;
my $metadata_fields = {
type => "replication",
diff --git a/templates/default/replication-body.txt.hbs b/templates/default/replication-body.txt.hbs
index a9273fef..b1894ce9 100644
--- a/templates/default/replication-body.txt.hbs
+++ b/templates/default/replication-body.txt.hbs
@@ -9,4 +9,4 @@ Note: The system will now reduce the frequency of error reports, as the job
appears to be stuck.
{{/if}}
Error:
-{{ error }}
+{{error}}
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-03-28 10:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 10:19 [pve-devel] [PATCH cluster/ha-manager/manager v2 0/6] preparation for #6143: notification template cleanup Lukas Wagner
2025-03-28 10:19 ` [pve-devel] [PATCH pve-cluster v2 1/1] notify: add common_template_data Lukas Wagner
2025-04-04 10:15 ` [pve-devel] applied: " Thomas Lamprecht
2025-03-28 10:19 ` [pve-devel] [PATCH pve-manager v2 1/4] notification templates: vzdump: generate HTML table in template Lukas Wagner
2025-03-28 10:19 ` [pve-devel] [PATCH pve-manager v2 2/4] notifications: apt: clean up notification template Lukas Wagner
2025-03-28 10:19 ` Lukas Wagner [this message]
2025-03-28 10:19 ` [pve-devel] [PATCH pve-manager v2 4/4] notifications: test: style fixup Lukas Wagner
2025-03-28 10:19 ` [pve-devel] [PATCH pve-ha-manager v2 1/1] notifications: overhaul fence notification Lukas Wagner
2025-04-04 18:25 ` [pve-devel] applied: " Thomas Lamprecht
2025-04-04 18:27 ` [pve-devel] applied-series: [PATCH cluster/ha-manager/manager v2 0/6] preparation for #6143: notification template cleanup Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250328101915.73951-5-l.wagner@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal