[pve-devel] [PATCH ha-manager 1/5] fix #6839: move PVE::Notify usage to "real" Env
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon Sep 22 14:04:30 CEST 2025
instead of doing it in PVE::NodeStatus, which is also pulled into the
simulator.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at 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
More information about the pve-devel
mailing list