WIP: Separate endpoint for each primary action for monitor hooks #660

Closed
jetchirag wants to merge 8 commits from jetchirag/borgmatic:action-based-monitor-endpoints into main
1 changed files with 2 additions and 1 deletions
Showing only changes of commit 2d728d57d7 - Show all commits

View File

@ -35,8 +35,9 @@ def ping_monitor(hook_config, config_filename, state, monitoring_log_level, dry_
dry_run_label = ' (dry run; not actually pinging)' if dry_run else ''
try:
ping_url = f"{hook_config[action_name]}/{MONITOR_STATE_TO_CRONITOR[state]}"
ping_url = f"{hook_config['sss']}/{MONITOR_STATE_TO_CRONITOR[state]}"
except KeyError:
jetchirag marked this conversation as resolved
Review

Nice, succinct way to skip unconfigured actions. You could optionally logger.debug() in the except so that it's clear what's being skipped and why.

Nice, succinct way to skip unconfigured actions. You could optionally `logger.debug()` in the `except` so that it's clear what's being skipped and why.
logger.debug(f'{config_filename}: Skipping Cronitor {state.name.lower()} ping due to unconfigured action: {action_name}')
jetchirag marked this conversation as resolved Outdated
Outdated
Review

Missed a debug log here 😄

Missed a debug log here 😄

Thanks! :)

Thanks! :)
return
logger.info(f'{config_filename}: Pinging Cronitor {state.name.lower()}{dry_run_label}')