From 5524d167070cd5c96fca60b56e435658169f0431 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Thu, 15 Jul 2021 13:21:40 +0200 Subject: [PATCH] btrbk: add warn_unknown_targets config option --- btrbk | 6 ++++-- doc/btrbk.conf.5.asciidoc | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/btrbk b/btrbk index ee449e6..83b2378 100755 --- a/btrbk +++ b/btrbk @@ -150,6 +150,8 @@ my %config_options = ( cache_dir => { default => undef, accept_file => { absolute => 1 }, allow_multiple => 1, context => [ "global" ] }, ignore_extent_data_inline => { default => "yes", accept => [ "yes", "no" ] }, + warn_unknown_targets => { default => undef, accept => [ "yes", "no" ] }, + # deprecated options ssh_port => { default => "default", accept => [ "default" ], accept_numeric => 1, deprecated => { DEFAULT => { warn => 'Please use "ssh://hostname[:port]" notation in the "volume" and "target" configuration lines.' } } }, @@ -3552,8 +3554,8 @@ sub get_receive_targets($$;@) else { TRACE "get_receive_targets: skip unexpected match: " . _fs_path($_) if($do_trace); ${$opts{ret_unexpected}} = 1 if($opts{ret_unexpected}); - if($opts{warn}) { - WARN "Receive target of \"$src_vol->{PRINT}\" exists at unexpected location: " . ($vinfo ? $vinfo->{PRINT} : _fs_path($_)); + if($opts{warn} && config_key($droot, "warn_unknown_targets")) { + WARN "Receive target of \"$src_vol->{PRINT}\" exists at unknown location: " . ($vinfo ? $vinfo->{PRINT} : _fs_path($_)); } next; } diff --git a/doc/btrbk.conf.5.asciidoc b/doc/btrbk.conf.5.asciidoc index 70dced5..eb19abd 100644 --- a/doc/btrbk.conf.5.asciidoc +++ b/doc/btrbk.conf.5.asciidoc @@ -451,6 +451,14 @@ If you want to set this option for regular (non-root) user only, set +=== Informative Options + +*warn_unknown_targets* yes|no:: + If set, prints a warning if btrbk encounters a target subvolume at + a unknown location (i.e. not following btrbk naming scheme, or + outside the target directory). Defaults to ``no''. + + RETENTION POLICY ----------------