proxmox/proxmox-notify
Lukas Wagner 50fa98e241 notify: api: allow resetting built-in targets if used by a matcher
In the 'delete'-handler targets, we check if a
target is still referenced by a matcher - if it is, we return an
error. For built-in targets, this is actually not necessary, since
'deleting' a built-in only resets it to its default settings - it will
continue to exist after that.
The user could easily trigger this if 'mail-to-root', which is
referenced by 'default-matcher' is modified and then reset to its
defaults: An error is shown, the built-in target is not reset.

This commit disables this check if it is a built-in target.

Renamed the helper 'ensure_unused' to 'ensure_safe_to_delete' in the
process.

Also fixed the tests in api::test - they were never executed due to a
faulty #[cfg] directive.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2024-01-10 12:29:26 +01:00
..
debian notify: bump version to 0.3.0-1 2023-11-17 13:36:55 +01:00
examples notify: factor out notification content into its own type 2023-11-17 08:31:36 +01:00
src notify: api: allow resetting built-in targets if used by a matcher 2024-01-10 12:29:26 +01:00
Cargo.toml notify: bump version to 0.3.0-1 2023-11-17 13:36:55 +01:00