[pve-devel] [PATCH manager] replication: fix uninitalized warning
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Mar 21 13:43:14 CET 2023
if a job has no schedule and is executed via "Schedule now" but fails, the
following will be printed to journal/syslog:
Mar 21 13:05:01 host02 pvescheduler[203343]: send/receive failed, cleaning up snapshot(s)..
Mar 21 13:05:01 host02 pvescheduler[203343]: 100-0: got unexpected replication job error - command 'set -o pipefail && pvesm export local-zfs:vm-100-disk-0 zfs - -with-snapshots 1 -snapshot __replicate_100-0_1679400300__ | /usr/bin/ssh -e none -o 'BatchMode=yes' -o 'HostKeyAlias=host03' root at 10.0.74.3 -- pvesm import local-zfs:vm-100-disk-0 zfs - -with-snapshots 1 -snapshot __replicate_100-0_1679400300__ -allow-rename 0' failed: exit code 255
Mar 21 13:05:01 host02 pvescheduler[203343]: Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/PVE/API2/Replication.pm line 107.
defaulting to the fallback schedule '*/15' makes the spurious warning go away.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
PVE/API2/Replication.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Replication.pm b/PVE/API2/Replication.pm
index af77d2f4..d70b4607 100644
--- a/PVE/API2/Replication.pm
+++ b/PVE/API2/Replication.pm
@@ -103,8 +103,10 @@ my sub _handle_job_err {
return if !_should_mail_at_failcount($fail_count);
+ my $schedule = $job->{schedule} // '*/15';
+
my $msg = "Replication job $job->{id} with target '$job->{target}' and schedule";
- $msg .= " '$job->{schedule}' failed!\n";
+ $msg .= " '$schedule' failed!\n";
$msg .= " Last successful sync: ";
if (my $last_sync = $jobstate->{last_sync}) {
--
2.30.2
More information about the pve-devel
mailing list