mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-10 09:53:10 +00:00
api: replication: adapt to matcher-based notification system
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
parent
5fa9db35b7
commit
3f0ffa0efe
@ -129,7 +129,7 @@ my sub _handle_job_err {
|
|||||||
# The replication job is run every 15 mins if no schedule is set.
|
# The replication job is run every 15 mins if no schedule is set.
|
||||||
my $schedule = $job->{schedule} // '*/15';
|
my $schedule = $job->{schedule} // '*/15';
|
||||||
|
|
||||||
my $properties = {
|
my $template_data = {
|
||||||
"failure-count" => $fail_count,
|
"failure-count" => $fail_count,
|
||||||
"last-sync" => $jobstate->{last_sync},
|
"last-sync" => $jobstate->{last_sync},
|
||||||
"next-sync" => $next_sync,
|
"next-sync" => $next_sync,
|
||||||
@ -139,19 +139,18 @@ my sub _handle_job_err {
|
|||||||
"error" => $err,
|
"error" => $err,
|
||||||
};
|
};
|
||||||
|
|
||||||
eval {
|
my $metadata_fields = {
|
||||||
my $dcconf = PVE::Cluster::cfs_read_file('datacenter.cfg');
|
# TODO: Add job-id?
|
||||||
my $target = $dcconf->{notify}->{'target-replication'} // PVE::Notify::default_target();
|
type => "replication",
|
||||||
my $notify = $dcconf->{notify}->{'replication'} // 'always';
|
};
|
||||||
|
|
||||||
if ($notify eq 'always') {
|
eval {
|
||||||
PVE::Notify::error(
|
PVE::Notify::error(
|
||||||
$target,
|
|
||||||
$replication_error_subject_template,
|
$replication_error_subject_template,
|
||||||
$replication_error_body_template,
|
$replication_error_body_template,
|
||||||
$properties
|
$template_data,
|
||||||
|
$metadata_fields
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
warn ": $@" if $@;
|
warn ": $@" if $@;
|
||||||
|
Loading…
Reference in New Issue
Block a user