[pve-devel] [PATCH pve-ha-manager 17/18] manager: send notifications via new notification module
Lukas Wagner
l.wagner at proxmox.com
Mon Mar 27 17:18:56 CEST 2023
... instead of using sendmail directly
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
src/PVE/HA/Env/PVE2.pm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index f6ebfeb..a3b30b5 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -13,6 +13,7 @@ use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file cfs_lock_file
use PVE::DataCenterConfig;
use PVE::INotify;
use PVE::RPCEnvironment;
+use PVE::Notification;
use PVE::HA::Tools ':exit_codes';
use PVE::HA::Env;
@@ -228,7 +229,17 @@ sub sendmail {
# mail to the address configured in the datacenter
my $mailto = 'root';
- PVE::Tools::sendmail($mailto, $subject, $text, undef, $mailfrom);
+ my $config = PVE::Notification::config();
+
+ # Add ephemeral sendmail endpoint for backwards compatibility
+ $config->add_sendmail_endpoint(
+ "legacy-ha-manager-sendmail",
+ [$mailto],
+ $mailfrom,
+ undef);
+
+
+ PVE::Notification::warning($subject, $text, $config);
}
my $last_lock_status_hash = {};
--
2.30.2
More information about the pve-devel
mailing list