}
sub send_notification {
- my ($self, $subject, $text, $properties) = @_;
+ my ($self, $subject, $text, $template_data, $metadata_fields) = @_;
eval {
- my $dc_config = PVE::Cluster::cfs_read_file('datacenter.cfg');
- my $target = $dc_config->{notify}->{'target-fencing'} // PVE::Notify::default_target();
- my $notify = $dc_config->{notify}->{fencing} // 'always';
-
- if ($notify eq 'always') {
- PVE::Notify::error($target, $subject, $text, $properties);
- }
+ PVE::Notify::error($subject, $text, $template_data, $metadata_fields);
};
$self->log("warning", "could not notify: $@") if $@;
my $haenv = $self->{haenv};
my $status = $haenv->read_manager_status();
- my $notification_properties = {
+ my $template_data = {
"status-data" => {
manager_status => $status,
node_status => $self->{status}
"subject" => $subject,
};
+ my $metadata_fields = {
+ type => 'fencing',
+ hostname => $node,
+ };
+
$haenv->send_notification(
$subject_template,
$body_template,
- $notification_properties
+ $template_data,
+ $metadata_fields,
);
+
};