mirror of https://github.com/digint/btrbk
btrbk: be harsh (abort) on deprecated "{snapshot,target}_preserve_{daily,weekly,monthly}" and "resume_missing no" options; change default of snapshot_preserve_min to one day
parent
36cc96fdb8
commit
7c0987bd3c
30
btrbk
30
btrbk
|
@ -80,8 +80,8 @@ my %config_options = (
|
||||||
incremental => { default => "yes", accept => [ "yes", "no", "strict" ] },
|
incremental => { default => "yes", accept => [ "yes", "no", "strict" ] },
|
||||||
preserve_day_of_week => { default => "sunday", accept => [ (keys %day_of_week_map) ] },
|
preserve_day_of_week => { default => "sunday", accept => [ (keys %day_of_week_map) ] },
|
||||||
snapshot_preserve => { default => undef, accept_preserve_matrix => 1, context => [ "root", "volume", "subvolume" ], },
|
snapshot_preserve => { default => undef, accept_preserve_matrix => 1, context => [ "root", "volume", "subvolume" ], },
|
||||||
|
snapshot_preserve_min => { default => "1d", accept => [ "all", "latest" ], accept_regexp => qr/^[1-9][0-9]*[hdwmy]$/, context => [ "root", "volume", "subvolume" ], },
|
||||||
target_preserve => { default => undef, accept_preserve_matrix => 1 },
|
target_preserve => { default => undef, accept_preserve_matrix => 1 },
|
||||||
snapshot_preserve_min => { default => '12h', accept => [ "all", "latest" ], accept_regexp => qr/^[0-9]+[hdwmy]$/, context => [ "root", "volume", "subvolume" ], },
|
|
||||||
target_preserve_min => { default => undef, accept => [ "all", "latest", "no" ], accept_regexp => qr/^[0-9]+[hdwmy]$/ },
|
target_preserve_min => { default => undef, accept => [ "all", "latest", "no" ], accept_regexp => qr/^[0-9]+[hdwmy]$/ },
|
||||||
btrfs_commit_delete => { default => undef, accept => [ "after", "each", "no" ] },
|
btrfs_commit_delete => { default => undef, accept => [ "after", "each", "no" ] },
|
||||||
ssh_identity => { default => undef, accept_file => { absolute => 1 } },
|
ssh_identity => { default => undef, accept_file => { absolute => 1 } },
|
||||||
|
@ -104,23 +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 => { COMPAT_PRESERVE_ALL => 1, DEFAULT => { warn => 'Please use "snapshot_preserve" and/or "snapshot_preserve_min"' } } },
|
deprecated => { DEFAULT => { ABORT => 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 => { COMPAT_PRESERVE_ALL => 1, DEFAULT => { warn => 'Please use "snapshot_preserve" and/or "snapshot_preserve_min"' } } },
|
deprecated => { DEFAULT => { ABORT => 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 => { COMPAT_PRESERVE_ALL => 1, DEFAULT => { warn => 'Please use "snapshot_preserve" and/or "snapshot_preserve_min"' } } },
|
deprecated => { DEFAULT => { ABORT => 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 => { COMPAT_PRESERVE_ALL => 1, DEFAULT => { warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
deprecated => { DEFAULT => { ABORT => 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 => { COMPAT_PRESERVE_ALL => 1, DEFAULT => { warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
deprecated => { DEFAULT => { ABORT => 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 => { COMPAT_PRESERVE_ALL => 1, DEFAULT => { warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
deprecated => { DEFAULT => { ABORT => 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' },
|
deprecated => { yes => { warn => 'ignoring (missing backups are always resumed since btrbk v0.23.0)' },
|
||||||
no => { warn => 'Please use "target_preserve_min latest" and "target_preserve no"',
|
no => { ABORT => 1, warn => 'Please use "target_preserve_min latest" and "target_preserve no" if you want to keep only the latest backup', } } },
|
||||||
replace_key => 'target_preserve',
|
|
||||||
replace_value => 'no',
|
|
||||||
} } },
|
|
||||||
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",
|
||||||
|
@ -2249,6 +2246,10 @@ sub append_config_option($$$$;$)
|
||||||
if($opt->{deprecated}) {
|
if($opt->{deprecated}) {
|
||||||
WARN "Found deprecated option \"$key $value\"" . $config_file_statement . ": " .
|
WARN "Found deprecated option \"$key $value\"" . $config_file_statement . ": " .
|
||||||
($opt->{deprecated}->{$value}->{warn} // $opt->{deprecated}->{DEFAULT}->{warn});
|
($opt->{deprecated}->{$value}->{warn} // $opt->{deprecated}->{DEFAULT}->{warn});
|
||||||
|
if($opt->{deprecated}->{$value}->{ABORT} || $opt->{deprecated}->{DEFAULT}->{ABORT}) {
|
||||||
|
ERROR 'Deprecated (incompatible) option found, refusing to continue';
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
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)) {
|
||||||
|
@ -2256,11 +2257,6 @@ sub append_config_option($$$$;$)
|
||||||
$value = $replace_value;
|
$value = $replace_value;
|
||||||
WARN "Using \"$key $value\"";
|
WARN "Using \"$key $value\"";
|
||||||
}
|
}
|
||||||
if($opt->{deprecated}->{COMPAT_PRESERVE_ALL}) {
|
|
||||||
$config_override{snapshot_preserve_min} = 'all';
|
|
||||||
$config_override{target_preserve_min} = 'all';
|
|
||||||
WARN "Refusing to delete anything!";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE "adding option \"$key=$value\" to $context context";
|
TRACE "adding option \"$key=$value\" to $context context";
|
||||||
|
|
|
@ -131,8 +131,8 @@ Set retention policy for snapshots (see RETENTION POLICY below).
|
||||||
Preserve all snapshots for a minimum amount of hours (h), days (d),
|
Preserve all snapshots for a minimum amount of hours (h), days (d),
|
||||||
weeks (w), months (m) or years (y), regardless of how many there
|
weeks (w), months (m) or years (y), regardless of how many there
|
||||||
are. If set to \[lq]all\[rq], preserve all snapshots forever. If set
|
are. If set to \[lq]all\[rq], preserve all snapshots forever. If set
|
||||||
to \[lq]latest\[rq], keep latest snapshot (useful only in conjunction
|
to \[lq]latest\[rq], preserve latest snapshot. Defaults to
|
||||||
with "snapshot_create no"). Defaults to \[lq]12h\[rq].
|
\[lq]1d\[rq].
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
\fBtarget_preserve\fR <retention_policy>
|
\fBtarget_preserve\fR <retention_policy>
|
||||||
|
|
Loading…
Reference in New Issue