mirror of https://github.com/digint/btrbk
btrbk: enter failsafe mode on deprecated preserve configuration: at least create the snapshots, and print message to read the upgrade documentation
parent
73906caacd
commit
a03c515b0a
35
btrbk
35
btrbk
|
@ -104,20 +104,20 @@ my %config_options = (
|
||||||
|
|
||||||
# deprecated options
|
# deprecated options
|
||||||
snapshot_preserve_daily => { default => 'all', accept => [ "all" ], accept_numeric => 1, context => [ "root", "volume", "subvolume" ],
|
snapshot_preserve_daily => { default => 'all', accept => [ "all" ], accept_numeric => 1, context => [ "root", "volume", "subvolume" ],
|
||||||
deprecated => { DEFAULT => { ABORT => 1, warn => 'Please use "snapshot_preserve" and/or "snapshot_preserve_min"' } } },
|
deprecated => { DEFAULT => { FAILSAFE_PRESERVE => 1, warn => 'Please use "snapshot_preserve" and/or "snapshot_preserve_min"' } } },
|
||||||
snapshot_preserve_weekly => { default => 0, accept => [ "all" ], accept_numeric => 1, context => [ "root", "volume", "subvolume" ],
|
snapshot_preserve_weekly => { default => 0, accept => [ "all" ], accept_numeric => 1, context => [ "root", "volume", "subvolume" ],
|
||||||
deprecated => { DEFAULT => { ABORT => 1, warn => 'Please use "snapshot_preserve" and/or "snapshot_preserve_min"' } } },
|
deprecated => { DEFAULT => { FAILSAFE_PRESERVE => 1, warn => 'Please use "snapshot_preserve" and/or "snapshot_preserve_min"' } } },
|
||||||
snapshot_preserve_monthly => { default => 'all', accept => [ "all" ], accept_numeric => 1, context => [ "root", "volume", "subvolume" ],
|
snapshot_preserve_monthly => { default => 'all', accept => [ "all" ], accept_numeric => 1, context => [ "root", "volume", "subvolume" ],
|
||||||
deprecated => { DEFAULT => { ABORT => 1, warn => 'Please use "snapshot_preserve" and/or "snapshot_preserve_min"' } } },
|
deprecated => { DEFAULT => { FAILSAFE_PRESERVE => 1, warn => 'Please use "snapshot_preserve" and/or "snapshot_preserve_min"' } } },
|
||||||
target_preserve_daily => { default => 'all', accept => [ "all" ], accept_numeric => 1,
|
target_preserve_daily => { default => 'all', accept => [ "all" ], accept_numeric => 1,
|
||||||
deprecated => { DEFAULT => { ABORT => 1, warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
deprecated => { DEFAULT => { FAILSAFE_PRESERVE => 1, warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
||||||
target_preserve_weekly => { default => 0, accept => [ "all" ], accept_numeric => 1,
|
target_preserve_weekly => { default => 0, accept => [ "all" ], accept_numeric => 1,
|
||||||
deprecated => { DEFAULT => { ABORT => 1, warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
deprecated => { DEFAULT => { FAILSAFE_PRESERVE => 1, warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
||||||
target_preserve_monthly => { default => 'all', accept => [ "all" ], accept_numeric => 1,
|
target_preserve_monthly => { default => 'all', accept => [ "all" ], accept_numeric => 1,
|
||||||
deprecated => { DEFAULT => { ABORT => 1, warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
deprecated => { DEFAULT => { FAILSAFE_PRESERVE => 1, warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
||||||
resume_missing => { default => "yes", accept => [ "yes", "no" ],
|
resume_missing => { default => "yes", accept => [ "yes", "no" ],
|
||||||
deprecated => { yes => { warn => 'ignoring (missing backups are always resumed since btrbk v0.23.0)' },
|
deprecated => { yes => { warn => 'ignoring (missing backups are always resumed since btrbk v0.23.0)' },
|
||||||
no => { ABORT => 1, warn => 'Please use "target_preserve_min latest" and "target_preserve no" if you want to keep only the latest backup', } } },
|
no => { FAILSAFE_PRESERVE => 1, warn => 'Please use "target_preserve_min latest" and "target_preserve no" if you want to keep only the latest backup', } } },
|
||||||
snapshot_create_always => { default => undef, accept => [ "yes", "no" ],
|
snapshot_create_always => { default => undef, accept => [ "yes", "no" ],
|
||||||
deprecated => { yes => { warn => "Please use \"snapshot_create always\"",
|
deprecated => { yes => { warn => "Please use \"snapshot_create always\"",
|
||||||
replace_key => "snapshot_create",
|
replace_key => "snapshot_create",
|
||||||
|
@ -2244,12 +2244,24 @@ sub append_config_option($$$$;$)
|
||||||
}
|
}
|
||||||
|
|
||||||
if($opt->{deprecated}) {
|
if($opt->{deprecated}) {
|
||||||
WARN "Found deprecated option \"$key $value\"" . $config_file_statement . ": " .
|
if(my $warn_msg = ($opt->{deprecated}->{$value}->{warn} || $opt->{deprecated}->{DEFAULT}->{warn})) {
|
||||||
($opt->{deprecated}->{$value}->{warn} // $opt->{deprecated}->{DEFAULT}->{warn});
|
WARN "Found deprecated option \"$key $value\"" . $config_file_statement . ": " . $warn_msg;
|
||||||
|
}
|
||||||
if($opt->{deprecated}->{$value}->{ABORT} || $opt->{deprecated}->{DEFAULT}->{ABORT}) {
|
if($opt->{deprecated}->{$value}->{ABORT} || $opt->{deprecated}->{DEFAULT}->{ABORT}) {
|
||||||
ERROR 'Deprecated (incompatible) option found, refusing to continue';
|
ERROR 'Deprecated (incompatible) option found, refusing to continue';
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
if($opt->{deprecated}->{$value}->{FAILSAFE_PRESERVE} || $opt->{deprecated}->{DEFAULT}->{FAILSAFE_PRESERVE}) {
|
||||||
|
unless($config_override{FAILSAFE_PRESERVE}) { # warn only once
|
||||||
|
WARN "Entering failsafe mode:";
|
||||||
|
WARN " - preserving ALL snapshots for ALL subvolumes";
|
||||||
|
WARN " - ignoring ALL targets (skipping backup creation)";
|
||||||
|
WARN " - please read \"doc/upgrade_to_v0.23.0.md\" <http://digint.ch/btrbk/doc/upgrade_to_v0.23.0.html>";
|
||||||
|
$config_override{FAILSAFE_PRESERVE} = "Failsafe mode active (deprecated configuration)";
|
||||||
|
}
|
||||||
|
$config_override{snapshot_preserve_min} = 'all';
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
my $replace_key = $opt->{deprecated}->{$value}->{replace_key};
|
my $replace_key = $opt->{deprecated}->{$value}->{replace_key};
|
||||||
my $replace_value = $opt->{deprecated}->{$value}->{replace_value};
|
my $replace_value = $opt->{deprecated}->{$value}->{replace_value};
|
||||||
if(defined($replace_key)) {
|
if(defined($replace_key)) {
|
||||||
|
@ -3747,6 +3759,11 @@ MAIN:
|
||||||
}
|
}
|
||||||
# TRACE(Data::Dumper->Dump([\@subvol_list], ["vinfo_raw_subvol_list{$droot}"]));
|
# TRACE(Data::Dumper->Dump([\@subvol_list], ["vinfo_raw_subvol_list{$droot}"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($config_override{FAILSAFE_PRESERVE}) {
|
||||||
|
ABORTED($droot, $config_override{FAILSAFE_PRESERVE});
|
||||||
|
WARN "Skipping target \"$droot->{PRINT}\": $abrt";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue