From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH ha-manager 1/5] fix #6839: move PVE::Notify usage to "real" Env
Date: Mon, 22 Sep 2025 14:04:30 +0200 [thread overview]
Message-ID: <20250922120550.674073-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20250922120550.674073-1-f.gruenbichler@proxmox.com>
instead of doing it in PVE::NodeStatus, which is also pulled into the
simulator.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
alternatively, we could also use the $have_.. / require hack here?
src/PVE/HA/Env/PVE2.pm | 5 +++++
src/PVE/HA/NodeStatus.pm | 4 +---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index e76e86b..2cec6f2 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -261,6 +261,11 @@ sub log {
sub send_notification {
my ($self, $template_name, $template_data, $metadata_fields) = @_;
+ # set here to avoid pulling in notification stack in simulator
+ my $common_data = PVE::Notify::common_template_data();
+ for my $key (keys $common_data->%*) {
+ $template_data->{$key} = $common_data->{$key} if !$template_data->{$key};
+ }
eval { PVE::Notify::error($template_name, $template_data, $metadata_fields); };
$self->log("warning", "could not notify: $@") if $@;
diff --git a/src/PVE/HA/NodeStatus.pm b/src/PVE/HA/NodeStatus.pm
index 0d04cd5..1512ae2 100644
--- a/src/PVE/HA/NodeStatus.pm
+++ b/src/PVE/HA/NodeStatus.pm
@@ -3,8 +3,6 @@ package PVE::HA::NodeStatus;
use strict;
use warnings;
-use PVE::Notify;
-
use JSON;
my $fence_delay = 60;
@@ -195,7 +193,7 @@ my $send_fence_state_email = sub {
my $haenv = $self->{haenv};
my $status = $haenv->read_manager_status();
- my $template_data = PVE::Notify::common_template_data();
+ my $template_data = {};
# Those two are needed for the expected output for test cases,
# see src/PVE/HA/Sim/Env.pm
$template_data->{"fence-status"} = $subject;
--
2.47.3
_______________________________________________
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-09-22 12:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 12:04 [pve-devel] [RFC ha-manager 0/5] make simulator standalone again Fabian Grünbichler
2025-09-22 12:04 ` Fabian Grünbichler [this message]
2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 2/5] build: install PVE::HA::Rules::* in simulator as well Fabian Grünbichler
2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 3/5] scheduling: make static scheduling optional Fabian Grünbichler
2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 4/5] build: install PVE::HA::Usage::Basic in simulator as well Fabian Grünbichler
2025-09-22 12:04 ` [pve-devel] [PATCH ha-manager 5/5] sim: add Cluster.pm stub with completion stub Fabian Grünbichler
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=20250922120550.674073-2-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.