Skip to content

Clarification about the scope and overlap of hooks #1611

@Chostakovitch

Description

@Chostakovitch

I'm not sure this is a bug or a feature.

I have a remote repository used to copy local snapshots.
I wanted to be alerted whenever a command failed for this repository, and I used something like:

# rest_server.toml
[repository]
# ...

[[global.hooks.run-failed]]
command = "<alert>"

This repository is used in a generic profile:

# global.toml
[copy]
targets = ["rest_server"]

and included in app-specific profiles, e.g.:

# app.toml
[global]
use-profiles = ["global"]
# ...

When the following command fails before of a repository issue (e.g. chunk size mismatch), the global hook is not called:

rustic -P app copy

However, when using repository rather than global hooks, it works.


The documentation is unclear about whether this is normal. It states that repository hooks:

should be used for commands needed to set up the repository (like mounting the repo dir).

and that they are executed for:

each repository-accessing commands

Does that mean that global are mutually exclusive with repository hooks, and that, by extension, in order to have a "global" run-failed hook, it should be defined for global, repository, backup and backup.snapshots hooks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-triageStatus: Waiting for a maintainer to triage this issue/PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions