diff --git a/NEWS b/NEWS index 4a8734ff..cd5d5f14 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +2.0.5.dev0 + * #1085: Fix a regression in which the default monitoring verbosity is 0 (warnings only) instead of + 1 (info about steps borgmatic is taking). This prevented logs from showing up in monitoring + services like Healthchecks unless you had an explicit monitoring verbosity set. + 2.0.4 * #1072: Fix path rewriting for non-root patterns in the ZFS, Btrfs, and LVM hooks. * #1073: Clarify the documentation about when an "after: error" command hook runs and how it diff --git a/borgmatic/commands/borgmatic.py b/borgmatic/commands/borgmatic.py index 7fadc263..78ed05c2 100644 --- a/borgmatic/commands/borgmatic.py +++ b/borgmatic/commands/borgmatic.py @@ -95,7 +95,9 @@ class Monitoring_hooks: self.config_filename = config_filename self.config = config self.dry_run = global_arguments.dry_run - self.monitoring_log_level = verbosity_to_log_level(config.get('monitoring_verbosity')) + self.monitoring_log_level = verbosity_to_log_level( + get_verbosity({config_filename: config}, 'monitoring_verbosity') + ) self.monitoring_hooks_are_activated = ( using_primary_action and self.monitoring_log_level != DISABLED ) diff --git a/pyproject.toml b/pyproject.toml index c5e63f69..da090fbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "borgmatic" -version = "2.0.4" +version = "2.0.5.dev0" authors = [ { name="Dan Helfman", email="witten@torsion.org" }, ] diff --git a/tests/unit/commands/test_borgmatic.py b/tests/unit/commands/test_borgmatic.py index e488a9ba..b196cfe6 100644 --- a/tests/unit/commands/test_borgmatic.py +++ b/tests/unit/commands/test_borgmatic.py @@ -28,6 +28,7 @@ def test_get_skip_actions_uses_config_and_arguments(config, arguments, expected_ def test_monitoring_hooks_with_monioring_disabled_bails(): + flexmock(module).should_receive('get_verbosity').and_return(module.logging.INFO) flexmock(module).should_receive('verbosity_to_log_level').and_return(module.DISABLED) flexmock(module.dispatch).should_receive('call_hooks').never() @@ -41,6 +42,7 @@ def test_monitoring_hooks_with_monioring_disabled_bails(): def test_monitoring_hooks_with_non_primary_action_bails(): + flexmock(module).should_receive('get_verbosity').and_return(module.logging.INFO) flexmock(module).should_receive('verbosity_to_log_level').and_return(flexmock()) flexmock(module.dispatch).should_receive('call_hooks').never() @@ -54,6 +56,7 @@ def test_monitoring_hooks_with_non_primary_action_bails(): def test_monitoring_hooks_pings_monitors(): + flexmock(module).should_receive('get_verbosity').and_return(module.logging.INFO) flexmock(module).should_receive('verbosity_to_log_level').and_return(flexmock()) flexmock(module.dispatch).should_receive('call_hooks').with_args( 'initialize_monitor', @@ -117,6 +120,7 @@ def test_monitoring_hooks_pings_monitors(): def test_monitoring_hooks_with_start_ping_error_raises(): + flexmock(module).should_receive('get_verbosity').and_return(module.logging.INFO) flexmock(module).should_receive('verbosity_to_log_level').and_return(flexmock()) flexmock(module.dispatch).should_receive('call_hooks').with_args( 'initialize_monitor', @@ -172,6 +176,7 @@ def test_monitoring_hooks_with_start_ping_error_raises(): def test_monitoring_hooks_with_log_ping_error_raises(): + flexmock(module).should_receive('get_verbosity').and_return(module.logging.INFO) flexmock(module).should_receive('verbosity_to_log_level').and_return(flexmock()) flexmock(module.dispatch).should_receive('call_hooks').with_args( 'initialize_monitor', @@ -227,6 +232,7 @@ def test_monitoring_hooks_with_log_ping_error_raises(): def test_monitoring_hooks_with_finish_ping_error_raises(): + flexmock(module).should_receive('get_verbosity').and_return(module.logging.INFO) flexmock(module).should_receive('verbosity_to_log_level').and_return(flexmock()) flexmock(module.dispatch).should_receive('call_hooks').with_args( 'initialize_monitor', @@ -281,7 +287,8 @@ def test_monitoring_hooks_with_finish_ping_error_raises(): pass -def test_monitoring_with_wrapped_code_error_pings_fail(): +def test_monitoring_hooks_with_wrapped_code_error_pings_fail(): + flexmock(module).should_receive('get_verbosity').and_return(module.logging.INFO) flexmock(module).should_receive('verbosity_to_log_level').and_return(flexmock()) flexmock(module.dispatch).should_receive('call_hooks').with_args( 'initialize_monitor', @@ -345,7 +352,8 @@ def test_monitoring_with_wrapped_code_error_pings_fail(): raise OSError() -def test_monitoring_with_fail_ping_error_raise_original_error(): +def test_monitoring_hooks_with_fail_ping_error_raise_original_error(): + flexmock(module).should_receive('get_verbosity').and_return(module.logging.INFO) flexmock(module).should_receive('verbosity_to_log_level').and_return(flexmock()) flexmock(module.dispatch).should_receive('call_hooks').with_args( 'initialize_monitor',