mirror of https://github.com/digint/btrbk
btrbk: rename context "root" to "global"
Use same naming as in documentation: btrbk.conf.5lsbtr-related
parent
c81e390415
commit
52a823bb93
44
btrbk
44
btrbk
|
@ -77,29 +77,29 @@ my %config_options = (
|
|||
# NOTE: the parser always maps "no" to undef
|
||||
# NOTE: keys "volume", "subvolume" and "target" are hardcoded
|
||||
# NOTE: files "." and "no" map to <undef>
|
||||
timestamp_format => { default => "short", accept => [ "short", "long", "long-iso" ], context => [ "root", "volume", "subvolume" ] },
|
||||
snapshot_dir => { default => undef, accept_file => { relative => 1 }, context => [ "root", "volume", "subvolume" ] },
|
||||
timestamp_format => { default => "short", accept => [ "short", "long", "long-iso" ], context => [ "global", "volume", "subvolume" ] },
|
||||
snapshot_dir => { default => undef, accept_file => { relative => 1 }, context => [ "global", "volume", "subvolume" ] },
|
||||
snapshot_name => { c_default => 1, accept_file => { name_only => 1 }, context => [ "subvolume" ], deny_glob_context => 1 }, # NOTE: defaults to the subvolume name (hardcoded)
|
||||
snapshot_create => { default => "always", accept => [ "no", "always", "ondemand", "onchange" ], context => [ "root", "volume", "subvolume" ] },
|
||||
snapshot_create => { default => "always", accept => [ "no", "always", "ondemand", "onchange" ], context => [ "global", "volume", "subvolume" ] },
|
||||
incremental => { default => "yes", accept => [ "yes", "no", "strict" ] },
|
||||
incremental_clones => { default => 0, accept_numeric => 1 },
|
||||
incremental_resolve => { default => "mountpoint", accept => [ "mountpoint", "directory", "_all_accessible" ] },
|
||||
preserve_day_of_week => { default => "sunday", accept => [ (keys %day_of_week_map) ] },
|
||||
preserve_hour_of_day => { default => 0, accept => [ (0..23) ] },
|
||||
snapshot_preserve => { default => undef, accept => [ "no" ], accept_preserve_matrix => 1, context => [ "root", "volume", "subvolume" ], },
|
||||
snapshot_preserve_min => { default => "all", accept => [ "all", "latest" ], accept_regexp => qr/^[1-9][0-9]*[hdwmy]$/, context => [ "root", "volume", "subvolume" ], },
|
||||
snapshot_preserve => { default => undef, accept => [ "no" ], accept_preserve_matrix => 1, context => [ "global", "volume", "subvolume" ], },
|
||||
snapshot_preserve_min => { default => "all", accept => [ "all", "latest" ], accept_regexp => qr/^[1-9][0-9]*[hdwmy]$/, context => [ "global", "volume", "subvolume" ], },
|
||||
target_preserve => { default => undef, accept => [ "no" ], accept_preserve_matrix => 1 },
|
||||
target_preserve_min => { default => "all", accept => [ "all", "latest", "no" ], accept_regexp => qr/^[0-9]+[hdwmy]$/ },
|
||||
archive_preserve => { default => undef, accept => [ "no" ], accept_preserve_matrix => 1, context => [ "root" ] },
|
||||
archive_preserve_min => { default => "all", accept => [ "all", "latest", "no" ], accept_regexp => qr/^[0-9]+[hdwmy]$/, context => [ "root" ] },
|
||||
archive_preserve => { default => undef, accept => [ "no" ], accept_preserve_matrix => 1, context => [ "global" ] },
|
||||
archive_preserve_min => { default => "all", accept => [ "all", "latest", "no" ], accept_regexp => qr/^[0-9]+[hdwmy]$/, context => [ "global" ] },
|
||||
btrfs_commit_delete => { default => undef, accept => [ "after", "each", "no" ] },
|
||||
ssh_identity => { default => undef, accept_file => { absolute => 1 } },
|
||||
ssh_user => { default => "root", accept_regexp => qr/^[a-z_][a-z0-9_-]*$/ },
|
||||
ssh_compression => { default => undef, accept => [ "yes", "no" ] },
|
||||
ssh_cipher_spec => { default => "default", accept_regexp => qr/^$ssh_cipher_match(,$ssh_cipher_match)*$/ },
|
||||
transaction_log => { default => undef, accept => [ "no" ], accept_file => { absolute => 1 }, context => [ "root" ] },
|
||||
transaction_syslog => { default => undef, accept => [ "no", @syslog_facilities ], context => [ "root" ] },
|
||||
lockfile => { default => undef, accept => [ "no" ], accept_file => { absolute => 1 }, context => [ "root" ] },
|
||||
transaction_log => { default => undef, accept => [ "no" ], accept_file => { absolute => 1 }, context => [ "global" ] },
|
||||
transaction_syslog => { default => undef, accept => [ "no", @syslog_facilities ], context => [ "global" ] },
|
||||
lockfile => { default => undef, accept => [ "no" ], accept_file => { absolute => 1 }, context => [ "global" ] },
|
||||
|
||||
rate_limit => { default => undef, accept => [ "no" ], accept_regexp => qr/^[0-9]+[kmgtKMGT]?$/, require_bin => 'mbuffer' },
|
||||
rate_limit_remote => { default => undef, accept => [ "no" ], accept_regexp => qr/^[0-9]+[kmgtKMGT]?$/ }, # NOTE: requires 'mbuffer' command on remote hosts
|
||||
|
@ -132,11 +132,11 @@ my %config_options = (
|
|||
backend_local => { default => undef, accept => [ "no", "btrfs-progs", "btrfs-progs-btrbk", "btrfs-progs-sudo" ] },
|
||||
backend_remote => { default => undef, accept => [ "no", "btrfs-progs", "btrfs-progs-btrbk", "btrfs-progs-sudo" ] },
|
||||
|
||||
snapshot_qgroup_destroy => { default => undef, accept => [ "yes", "no" ], context => [ "root", "volume", "subvolume" ] },
|
||||
snapshot_qgroup_destroy => { default => undef, accept => [ "yes", "no" ], context => [ "global", "volume", "subvolume" ] },
|
||||
target_qgroup_destroy => { default => undef, accept => [ "yes", "no" ] },
|
||||
archive_qgroup_destroy => { default => undef, accept => [ "yes", "no" ], context => [ "root" ] },
|
||||
archive_qgroup_destroy => { default => undef, accept => [ "yes", "no" ], context => [ "global" ] },
|
||||
|
||||
archive_exclude => { default => undef, accept_file => { wildcards => 1 }, allow_multiple => 1, context => [ "root" ] },
|
||||
archive_exclude => { default => undef, accept_file => { wildcards => 1 }, allow_multiple => 1, context => [ "global" ] },
|
||||
archive_exclude_older => { default => undef, accept => [ "yes", "no" ] },
|
||||
|
||||
# deprecated options
|
||||
|
@ -144,11 +144,11 @@ my %config_options = (
|
|||
deprecated => { DEFAULT => { warn => 'Please use "ssh://hostname[:port]" notation in the "volume" and "target" configuration lines.' } } },
|
||||
btrfs_progs_compat => { default => undef, accept => [ "yes", "no" ],
|
||||
deprecated => { DEFAULT => { ABORT => 1, warn => 'This feature has been dropped in btrbk-v0.23.0. Please update to newest btrfs-progs, AT LEAST >= $BTRFS_PROGS_MIN' } } },
|
||||
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 => [ "global", "volume", "subvolume" ],
|
||||
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 => [ "global", "volume", "subvolume" ],
|
||||
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 => [ "global", "volume", "subvolume" ],
|
||||
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,
|
||||
deprecated => { DEFAULT => { FAILSAFE_PRESERVE => 1, warn => 'Please use "target_preserve" and/or "target_preserve_min"' } } },
|
||||
|
@ -3707,7 +3707,7 @@ sub append_config_option($$$$;@)
|
|||
}
|
||||
|
||||
if($opt->{context} && !grep(/^$context$/, @{$opt->{context}}) && ($context ne "OVERRIDE")) {
|
||||
ERROR "Option \"$key\" is only allowed in " . join(" or ", map("\"$_\"", @{$opt->{context}})) . " context $error_statement";
|
||||
ERROR "Option \"$key\" is only allowed in " . join(" or ", @{$opt->{context}}) . " context $error_statement";
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
@ -3848,8 +3848,8 @@ sub parse_config_line($$$$$)
|
|||
# be very strict about file options, for security sake
|
||||
my ($url_prefix, $path) = check_url($value, error_statement => "for option \"$key\" in \"$file\" line $.");
|
||||
return undef unless(defined($path));
|
||||
TRACE "config: adding volume \"$url_prefix$path\" to root context";
|
||||
die unless($cur->{CONTEXT} eq "root");
|
||||
TRACE "config: adding volume \"$url_prefix$path\" to global context";
|
||||
die unless($cur->{CONTEXT} eq "global");
|
||||
my $volume = { CONTEXT => "volume",
|
||||
PARENT => $cur,
|
||||
SUBSECTION => [],
|
||||
|
@ -3861,7 +3861,7 @@ sub parse_config_line($$$$$)
|
|||
elsif($key eq "subvolume")
|
||||
{
|
||||
while($cur->{CONTEXT} ne "volume") {
|
||||
if(($cur->{CONTEXT} eq "root") || (not $cur->{PARENT})) {
|
||||
if(($cur->{CONTEXT} eq "global") || (not $cur->{PARENT})) {
|
||||
ERROR "Subvolume keyword outside volume context, in \"$file\" line $.";
|
||||
return undef;
|
||||
}
|
||||
|
@ -3992,7 +3992,7 @@ sub init_config(@)
|
|||
next if $config_options{$_}->{deprecated}; # don't pollute hash with deprecated options
|
||||
$defaults{$_} = $config_options{$_}->{default};
|
||||
}
|
||||
return { CONTEXT => "root", SUBSECTION => [], PARENT => \%defaults };
|
||||
return { CONTEXT => "global", SUBSECTION => [], PARENT => \%defaults };
|
||||
}
|
||||
|
||||
|
||||
|
@ -5810,7 +5810,7 @@ MAIN:
|
|||
{
|
||||
# no filter_args present, abort "noauto" contexts
|
||||
if(config_key($config, "noauto")) {
|
||||
WARN "Option \"noauto\" is set in root context, and no filter argument present, exiting";
|
||||
WARN "Option \"noauto\" is set in global context, and no filter argument present, exiting";
|
||||
exit 0;
|
||||
}
|
||||
foreach my $sroot (vinfo_subsection($config, 'volume')) {
|
||||
|
|
Loading…
Reference in New Issue