syncoid should exit with an error if the specified src dataset doesn't exist (and only skip child datasets which vanished)

This commit is contained in:
Christoph Klaffl 2022-09-13 17:13:01 +02:00
parent ef601eb96b
commit 0808575874
No known key found for this signature in database
GPG Key ID: 8FC1D76EED4970D2
1 changed files with 5 additions and 1 deletions

View File

@ -141,6 +141,8 @@ my %avail = checkcommands();
my %snaps; my %snaps;
my $exitcode = 0; my $exitcode = 0;
my $replicationCount = 0;
## break here to call replication individually so that we ## ## break here to call replication individually so that we ##
## can loop across children separately, for recursive ## ## can loop across children separately, for recursive ##
## replication ## ## replication ##
@ -297,7 +299,7 @@ sub syncdataset {
if (!defined $sync) { if (!defined $sync) {
# zfs already printed the corresponding error # zfs already printed the corresponding error
if ($error =~ /\bdataset does not exist\b/) { if ($error =~ /\bdataset does not exist\b/ && $replicationCount > 0) {
if (!$quiet) { print "WARN Skipping dataset (dataset no longer exists): $sourcefs...\n"; } if (!$quiet) { print "WARN Skipping dataset (dataset no longer exists): $sourcefs...\n"; }
return 0; return 0;
} }
@ -811,6 +813,8 @@ sub syncdataset {
} }
} }
$replicationCount++;
if (defined $args{'no-sync-snap'}) { if (defined $args{'no-sync-snap'}) {
if (defined $args{'create-bookmark'}) { if (defined $args{'create-bookmark'}) {
my $bookmarkcmd; my $bookmarkcmd;