Monitors other than Healthchecks traceback when run #336

Closed
opened 2020-06-26 03:22:34 +00:00 by witten · 2 comments
Owner

What I'm trying to do and why

Run any monitor other than the Healthchecks, to verify that the Healthchecks fix (#328) in borgmatic 1.5.7 doesn't regress other monitors.

Steps to reproduce (if a bug)

Configure a non-Healthchecks monitor in the hooks section. Run borgmatic create.

Actual behavior (if a bug)

Observe a traceback:

...
test.yaml: Pinging Cronitor finish
test.yaml: Using Cronitor ping URL https://cronitor.link/abc123/complete
test.yaml: Calling cronitor hook function destroy_monitor
Traceback (most recent call last):
  File "/usr/bin/borgmatic", line 11, in <module>
    load_entry_point('borgmatic', 'console_scripts', 'borgmatic')()
  File "/home/witten/code/borgmatic/borgmatic/commands/borgmatic.py", line 744, in main
    summary_logs = parse_logs + list(collect_configuration_run_summary_logs(configs, arguments))
  File "/home/witten/code/borgmatic/borgmatic/commands/borgmatic.py", line 642, in collect_configuration_run_summary_logs
    results = list(run_configuration(config_filename, config, arguments))
  File "/home/witten/code/borgmatic/borgmatic/commands/borgmatic.py", line 177, in run_configuration
    dispatch.call_hooks(
  File "/home/witten/code/borgmatic/borgmatic/hooks/dispatch.py", line 58, in call_hooks
    return {
  File "/home/witten/code/borgmatic/borgmatic/hooks/dispatch.py", line 59, in <dictcomp>
    hook_name: call_hook(function_name, hooks, log_prefix, hook_name, *args, **kwargs)
  File "/home/witten/code/borgmatic/borgmatic/hooks/dispatch.py", line 41, in call_hook
    return getattr(module, function_name)(config, log_prefix, *args, **kwargs)
AttributeError: module 'borgmatic.hooks.cronitor' has no attribute 'destroy_monitor'

Expected behavior (if a bug)

Don't traceback, and successfully ping the monitoring service.

Other notes / implementation ideas

The problem is that a destroy_monitor() function is now expected in each monitor, but Healthchecks is the only one that implements it. The fix is to implement destroy_monitor() within each other monitor hook.

Environment

borgmatic version: 1.5.7

borgmatic installation method: pip install --editable

Borg version: 1.1.11

Python version: 3.8.3

Database version (if applicable): n/a

operating system and version: Manjaro stable

#### What I'm trying to do and why Run any monitor other than the Healthchecks, to verify that the Healthchecks fix (#328) in borgmatic 1.5.7 doesn't regress other monitors. #### Steps to reproduce (if a bug) Configure a non-Healthchecks monitor in the `hooks` section. Run `borgmatic create`. #### Actual behavior (if a bug) Observe a traceback: ``` ... test.yaml: Pinging Cronitor finish test.yaml: Using Cronitor ping URL https://cronitor.link/abc123/complete test.yaml: Calling cronitor hook function destroy_monitor Traceback (most recent call last): File "/usr/bin/borgmatic", line 11, in <module> load_entry_point('borgmatic', 'console_scripts', 'borgmatic')() File "/home/witten/code/borgmatic/borgmatic/commands/borgmatic.py", line 744, in main summary_logs = parse_logs + list(collect_configuration_run_summary_logs(configs, arguments)) File "/home/witten/code/borgmatic/borgmatic/commands/borgmatic.py", line 642, in collect_configuration_run_summary_logs results = list(run_configuration(config_filename, config, arguments)) File "/home/witten/code/borgmatic/borgmatic/commands/borgmatic.py", line 177, in run_configuration dispatch.call_hooks( File "/home/witten/code/borgmatic/borgmatic/hooks/dispatch.py", line 58, in call_hooks return { File "/home/witten/code/borgmatic/borgmatic/hooks/dispatch.py", line 59, in <dictcomp> hook_name: call_hook(function_name, hooks, log_prefix, hook_name, *args, **kwargs) File "/home/witten/code/borgmatic/borgmatic/hooks/dispatch.py", line 41, in call_hook return getattr(module, function_name)(config, log_prefix, *args, **kwargs) AttributeError: module 'borgmatic.hooks.cronitor' has no attribute 'destroy_monitor' ``` #### Expected behavior (if a bug) Don't traceback, and successfully ping the monitoring service. #### Other notes / implementation ideas The problem is that a `destroy_monitor()` function is now expected in each monitor, but Healthchecks is the only one that implements it. The fix is to implement `destroy_monitor()` within each other monitor hook. #### Environment **borgmatic version:** 1.5.7 **borgmatic installation method:** `pip install --editable` **Borg version:** 1.1.11 **Python version:** 3.8.3 **Database version (if applicable):** n/a **operating system and version:** Manjaro stable
witten added the
bug
label 2020-06-26 03:24:49 +00:00
Author
Owner

Fixed in master. Will be released in the next borgmatic release.

Fixed in master. Will be released in the next borgmatic release.
Author
Owner

Released in borgmatic 1.5.8.

Released in borgmatic 1.5.8.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#336
No description provided.