[pve-devel] [PATCH pve-ha-manager v3 5/8] env: notify: use named templates instead of passing template strings

2024-05-21 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- debian/pve-ha-manager.install | 3 +++ src/Makefile | 1 + src/PVE/HA/Env/PVE2.pm| 4 ++-- src/PVE/HA/NodeStatus.pm | 20 +-- src/PVE/HA/Sim/Env.pm

[pve-devel] [PATCH proxmox-perl-rs v3 2/8] notify: don't pass config structs by reference

2024-05-21 Thread Lukas Wagner
proxmox_notify's api functions have been changed so that they take ownership of config structs. Signed-off-by: Lukas Wagner --- common/src/notify.rs | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/common/src/notify.rs b/common/src/notify.rs index

[pve-devel] [PATCH many v3 0/8] notifications: move template strings to template files

2024-05-21 Thread Lukas Wagner
cosmetics/style proxmox-perl-rs: Lukas Wagner (3): notify: use file based notification templates notify: don't pass config structs by reference notify: adapt to Option> to Vec changes in proxmox_notify common/src/notify.rs | 48 +--- 1 file changed,

[pve-devel] [PATCH proxmox-perl-rs v3 3/8] notify: adapt to Option> to Vec changes in proxmox_notify

2024-05-21 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- common/src/notify.rs | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/src/notify.rs b/common/src/notify.rs index 00a6056..e1b006b 100644 --- a/common/src/notify.rs +++ b/common/src/notify.rs @@ -153,8 +153,8 @@ mod export

[pve-devel] [PATCH manager v3 8/8] notifications: use named templates instead of in-code templates

2024-05-21 Thread Lukas Wagner
This commit adapts notification sending for - package update - replication - backups to use named templates (installed in /usr/share/pve-manager/templates) instead of passing template strings defined in code to the notification stack. Signed-off-by: Lukas Wagner --- Makefile

[pve-devel] [PATCH manager v3 7/8] tests: remove vzdump_notification test

2024-05-21 Thread Lukas Wagner
testing if the backup logs are shortened if they ware too long - so they are just removed. Signed-off-by: Lukas Wagner --- test/Makefile| 6 +- test/vzdump_notification_test.pl | 101 --- 2 files changed, 1 insertion(+), 106 deletions(-) delete

[pve-devel] [PATCH manager v3 6/8] gitignore: ignore any test artifacts

2024-05-21 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index e8d1eb27..481ae1e0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ dest/ /www/mobile/pvemanager-mobile.js /www/touch/touch-[0-9]*/ /pve-manager-[0-9

[pve-devel] [PATCH cluster v3 4/8] notify: use named template instead of passing template strings

2024-05-21 Thread Lukas Wagner
The notification system will now load template files from a defined location. The template to use is now passed to proxmox_notify, instead of separate template strings for subject/body. Signed-off-by: Lukas Wagner --- src/PVE/Notify.pm | 29 - 1 file changed, 12

[pve-devel] [PATCH proxmox-perl-rs v3 1/8] notify: use file based notification templates

2024-05-21 Thread Lukas Wagner
Instead of passing literal template strings to the notification system, we now only pass an identifier. This identifier will be used load the template files from a product-specific directory. Signed-off-by: Lukas Wagner --- common/src/notify.rs | 8 +++- 1 file changed, 3 insertions(+), 5

Re: [pve-devel] [PATCH docs v6 15/16] notifications: describe new notification metadata fields

2024-04-22 Thread Lukas Wagner
On 2024-04-22 11:10, Fiona Ebner wrote: >> +| Cluster node fenced |`fencing` | `error` | >> `hostname` >> +| Storage replication job failed |`replication` | `error` | >> `hostname`, `job-id` >> +| Backup succeeded |`vzdump` | `info`

[pve-devel] [PATCH docs v6 15/16] notifications: describe new notification metadata fields

2024-04-22 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- notifications.adoc | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/notifications.adoc b/notifications.adoc index 57053c8..dec878a 100644 --- a/notifications.adoc +++ b/notifications.adoc @@ -289,19 +289,21 @@ Notification

[pve-devel] [PATCH docs v6 16/16] notifications: match-field 'exact'-mode can now match multiple values

2024-04-22 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- notifications.adoc | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/notifications.adoc b/notifications.adoc index dec878a..07f0b3e 100644 --- a/notifications.adoc +++ b/notifications.adoc @@ -221,11 +221,16 @@ configurable

[pve-devel] [PATCH docs v6 14/16] notification: clarify that 'hostname' does not include the domain

2024-04-22 Thread Lukas Wagner
This was a bit inconsistent between the different notification types: - APT/VZDump included the domain part - fence notifications did not A decision has been made to unify this by removing the domain part from APT/VZDump notifications. Signed-off-by: Lukas Wagner --- notifications.adoc | 2

[pve-devel] [PATCH manager v6 07/16] api: replication: include 'hostname' field for notifications

2024-04-22 Thread Lukas Wagner
The field contains the hostname of the host (without any domain part) which sends the notification. This field can be used in match-field match rules. Signed-off-by: Lukas Wagner --- PVE/API2/Replication.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PVE/API2/Replication.pm b/PVE/API2

[pve-devel] [PATCH manager v6 04/16] ui: dc: backup: allow to set custom job id in advanced settings

2024-04-22 Thread Lukas Wagner
This might be useful if somebody wants to match on the new 'backup-job' field in a notification match rule. Signed-off-by: Lukas Wagner --- www/manager6/Utils.js | 1 + www/manager6/panel/BackupAdvancedOptions.js | 15 +++ 2 files changed, 16 insertions

[pve-devel] [PATCH manager v6 05/16] api: replication: add 'job-id' to notification metadata

2024-04-22 Thread Lukas Wagner
This allows users to create notification match rules for specific replication jobs, if they so desire. Signed-off-by: Lukas Wagner --- PVE/API2/Replication.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PVE/API2/Replication.pm b/PVE/API2/Replication.pm index 0dc944c9

[pve-devel] [PATCH manager v6 09/16] ui: utils: add overrides for translatable notification fields/values

2024-04-22 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- www/manager6/Utils.js | 11 +++ 1 file changed, 11 insertions(+) diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index 5216198b..89929d21 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -2060,6 +2060,17 @@ Ext.define

[pve-devel] [PATCH widget-toolkit v6 10/16] notification: matcher: match-field: show known fields/values

2024-04-22 Thread Lukas Wagner
of known fields/values is retrieved from new API endpoints. Some values are marked 'internal' by the backend. This means that the 'value' field was not user-created (counter example: backup job IDs) and can therefore be used as a base for translations. Signed-off-by: Lukas Wagner Tested

[pve-devel] [PATCH widget-toolkit v6 13/16] notification: matcher: move match-severity fields to panel

2024-04-22 Thread Lukas Wagner
Also introduce a local viewModel that is linked to a parent viewModel, allowing us to move the formulas to the panel. This should make the code more cohesive and easier to follow. No functional changes. Signed-off-by: Lukas Wagner Tested-by: Maximiliano Sandoval --- src/window

[pve-devel] [PATCH widget-toolkit v6 11/16] notification: matcher: move match-field formulas to local viewModel

2024-04-22 Thread Lukas Wagner
This should make the code more cohesive and easier to follow. No functional changes. Signed-off-by: Lukas Wagner Tested-by: Maximiliano Sandoval --- src/window/NotificationMatcherEdit.js | 186 +- 1 file changed, 92 insertions(+), 94 deletions(-) diff --git a/src

[pve-devel] [PATCH manager v6 08/16] api: notification: add API for getting known metadata fields/values

2024-04-22 Thread Lukas Wagner
This new API route returns known notification metadata fields and a list of known possible values. This will be used by the UI to provide suggestions when adding/modifying match rules. Signed-off-by: Lukas Wagner --- PVE/API2/Cluster/Notifications.pm | 139 ++ 1 file

[pve-devel] [PATCH widget-toolkit v6 12/16] notification: matcher: move match-calendar fields to panel

2024-04-22 Thread Lukas Wagner
Also introduce a local viewModel that is linked to a parent viewModel, allowing us to move the formulas to the panel. This should make the code more cohesive and easier to follow. No functional changes. Signed-off-by: Lukas Wagner Tested-by: Maximiliano Sandoval --- src/window

[pve-devel] [PATCH docs/guest-common/manager/widget-toolkit v6 00/16] notifications: notification metadata matching improvements

2024-04-22 Thread Lukas Wagner
-b trailer in UI patches pve-guest-common: Lukas Wagner (1): vzdump: common: allow 'job-id' as a parameter without being in schema src/PVE/VZDump/Common.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) pve-manager: Lukas Wagner (8): api: jobs: vzdump: pass job 'job-id' parameter

[pve-devel] [PATCH manager v6 06/16] vzdump: apt: notification: do not include domain in 'hostname' field

2024-04-22 Thread Lukas Wagner
in soft-breakage for any users who have already relied on the domain being present. If there is need for it, it could include a fqdn metadata field. The hostname property used for rendering the notification template is unaffected for now. Signed-off-by: Lukas Wagner --- PVE/API2/APT.pm | 3

[pve-devel] [PATCH manager v6 02/16] api: jobs: vzdump: pass job 'job-id' parameter

2024-04-22 Thread Lukas Wagner
This allows us to access us the backup job id in the send_notification function, where we can set it as metadata for the notification. Signed-off-by: Lukas Wagner --- PVE/API2/VZDump.pm | 8 PVE/Jobs/VZDump.pm | 4 +++- PVE/VZDump.pm | 6 +++--- 3 files changed, 14 insertions

[pve-devel] [PATCH manager v6 03/16] ui: dc: backup: send 'job-id' property when starting a backup job manually

2024-04-22 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- www/manager6/dc/Backup.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js index 2619a77b..d68f553c 100644 --- a/www/manager6/dc/Backup.js +++ b/www/manager6/dc/Backup.js @@ -586,11 +586,12

[pve-devel] [PATCH pve-guest-common v6 01/16] vzdump: common: allow 'job-id' as a parameter without being in schema

2024-04-22 Thread Lukas Wagner
'job-id' is passed when a backup as started as a job and will be passed to the notification system as matchable metadata. It it can be considered 'internal'. Signed-off-by: Lukas Wagner --- src/PVE/VZDump/Common.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PVE

[pve-devel] [PATCH proxmox v2 01/20] notify: switch to file-based templating system

2024-04-19 Thread Lukas Wagner
' HTML/plaintext formatting. However, in hindsight this turned out to be pretty finicky. Since the current changes lay the foundations for user-customizable notification templates, I ripped these abstractions out. Now there are simply two templates, one for plaintext, one for HTML. Signed-off-by: Lukas

[pve-devel] [PATCH proxmox v2 02/20] notify: make api methods take config struct ownership

2024-04-19 Thread Lukas Wagner
This saves us from some of the awkward cloning steps when updating. Suggested-by: Wolfgang Bumiller Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes Reviewed-by: Fiona Ebner --- proxmox-notify/src/api/gotify.rs | 46 +- proxmox-notify/src/api/matcher.rs | 38

[pve-devel] [PATCH proxmox v2 03/20] notify: convert Option> -> Vec in config structs

2024-04-19 Thread Lukas Wagner
Suggested-by: Wolfgang Bumiller Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes Reviewed-by: Fiona Ebner --- proxmox-notify/src/api/matcher.rs | 27 +++ proxmox-notify/src/api/mod.rs | 22 +--- proxmox-notify/src/api/sendmail.rs | 22

[pve-devel] [PATCH proxmox-perl-rs v2 14/20] notify: don't pass config structs by reference

2024-04-19 Thread Lukas Wagner
proxmox_notify's api functions have been changed so that they take ownership of config structs. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes Reviewed-by: Fiona Ebner --- common/src/notify.rs | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git

[pve-devel] [PATCH proxmox v2 09/20] notify: derive `api` for Deleteable*Property

2024-04-19 Thread Lukas Wagner
The API endpoints in Proxmox Backup Server require ApiType to be implemented for any deserialized parameter. Signed-off-by: Lukas Wagner Reviewed-by: Fiona Ebner --- proxmox-notify/src/endpoints/gotify.rs | 3 +++ proxmox-notify/src/endpoints/sendmail.rs | 7 +++ proxmox-notify/src

[pve-devel] [PATCH proxmox-perl-rs v2 13/20] notify: use file based notification templates

2024-04-19 Thread Lukas Wagner
Instead of passing literal template strings to the notification system, we now only pass an identifier. This identifier will be used load the template files from a product-specific directory. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes Reviewed-by: Fiona Ebner --- common/src

[pve-devel] [PATCH proxmox-perl-rs v2 15/20] notify: adapt to Option> to Vec changes in proxmox_notify

2024-04-19 Thread Lukas Wagner
Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes Reviewed-by: Fiona Ebner --- common/src/notify.rs | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/src/notify.rs b/common/src/notify.rs index 00a6056..e1b006b 100644 --- a/common/src/notify.rs +++ b

[pve-devel] [PATCH proxmox v2 10/20] notify: derive Deserialize/Serialize for Notification struct

2024-04-19 Thread Lukas Wagner
Signed-off-by: Lukas Wagner Reviewed-by: Fiona Ebner --- proxmox-notify/src/lib.rs | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/proxmox-notify/src/lib.rs b/proxmox-notify/src/lib.rs index 91c0b61..292396b 100644 --- a/proxmox-notify/src/lib.rs +++ b/proxmox

[pve-devel] [PATCH proxmox v2 11/20] notify: pbs context: include nodename in default sendmail author

2024-04-19 Thread Lukas Wagner
The old notification stack in proxmox-backup includes the nodename, so we include it here as well. Signed-off-by: Lukas Wagner Reviewed-by: Fiona Ebner --- proxmox-notify/src/context/pbs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxmox-notify/src/context/pbs.rs b

[pve-devel] [PATCH proxmox v2 08/20] notify: api: add get_targets

2024-04-19 Thread Lukas Wagner
This method allows us to get a list of all notification targets. Signed-off-by: Lukas Wagner Reviewed-by: Fiona Ebner --- proxmox-notify/src/api/mod.rs | 77 +++ 1 file changed, 77 insertions(+) diff --git a/proxmox-notify/src/api/mod.rs b/proxmox-notify/src

[pve-devel] [PATCH proxmox v2 07/20] notify: give each notification a unique ID

2024-04-19 Thread Lukas Wagner
We need this for queuing notifications on PBS from the unprivileged proxy process. Signed-off-by: Lukas Wagner Reviewed-by: Fiona Ebner --- proxmox-notify/Cargo.toml | 1 + proxmox-notify/src/lib.rs | 11 +++ 2 files changed, 12 insertions(+) diff --git a/proxmox-notify/Cargo.toml b

[pve-devel] [PATCH manager v2 20/20] notifications: use named templates instead of in-code templates

2024-04-19 Thread Lukas Wagner
This commit adapts notification sending for - package update - replication - backups to use named templates (installed in /usr/share/pve-manager/templates) instead of passing template strings defined in code to the notification stack. Signed-off-by: Lukas Wagner Tested-by: Folke

[pve-devel] [PATCH pve-ha-manager v2 17/20] env: notify: use named templates instead of passing template strings

2024-04-19 Thread Lukas Wagner
Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes Reviewed-by: Fiona Ebner --- debian/pve-ha-manager.install | 3 +++ src/Makefile | 1 + src/PVE/HA/Env/PVE2.pm| 4 ++-- src/PVE/HA/NodeStatus.pm

[pve-devel] [PATCH manager v2 19/20] tests: remove vzdump_notification test

2024-04-19 Thread Lukas Wagner
testing if the backup logs are shortened if they ware too long - so they are just removed. Signed-off-by: Lukas Wagner Reviewed-by: Fiona Ebner --- test/Makefile| 6 +- test/vzdump_notification_test.pl | 101 --- 2 files changed, 1 insertion

[pve-devel] [PATCH cluster v2 16/20] notify: use named template instead of passing template strings

2024-04-19 Thread Lukas Wagner
The notification system will now load template files from a defined location. The template to use is now passed to proxmox_notify, instead of separate template strings for subject/body. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes Reviewed-by: Fiona Ebner --- src/PVE/Notify.pm | 29

[pve-devel] [PATCH proxmox v2 04/20] notify: don't make tests require pve-context

2024-04-19 Thread Lukas Wagner
Tests now have their own context, so requiring pve-context is not necessary any more. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes Reviewed-by: Fiona Ebner --- proxmox-notify/src/api/gotify.rs | 2 +- proxmox-notify/src/api/matcher.rs | 2 +- proxmox-notify/src/api/sendmail.rs

[pve-devel] [PATCH manager v2 18/20] gitignore: ignore any test artifacts

2024-04-19 Thread Lukas Wagner
Signed-off-by: Lukas Wagner Reviewed-by: Fiona Ebner --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index e8d1eb27..481ae1e0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ dest/ /www/mobile/pvemanager-mobile.js /www/touch/touch-[0-9

[pve-devel] [PATCH proxmox v2 12/20] notify: renderer: add relative-percentage helper from PBS

2024-04-19 Thread Lukas Wagner
Signed-off-by: Lukas Wagner Reviewed-by: Fiona Ebner --- proxmox-notify/src/renderer/mod.rs | 29 + 1 file changed, 29 insertions(+) diff --git a/proxmox-notify/src/renderer/mod.rs b/proxmox-notify/src/renderer/mod.rs index a51ece6..ddb241d 100644 --- a/proxmox

[pve-devel] [PATCH proxmox v2 06/20] notify: cargo.toml: add spaces before curly braces

2024-04-19 Thread Lukas Wagner
Signed-off-by: Lukas Wagner Reviewed-by: Fiona Ebner --- proxmox-notify/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxmox-notify/Cargo.toml b/proxmox-notify/Cargo.toml index 3e8d253..185b50a 100644 --- a/proxmox-notify/Cargo.toml +++ b/proxmox-notify

[pve-devel] [PATCH proxmox v2 05/20] notify: make the `mail-forwarder` feature depend on proxmox-sys

2024-04-19 Thread Lukas Wagner
It uses proxmox_sys::nodename - the dep is needed, otherwise the code does not compile in some feature flag permutations. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes Reviewed-by: Fiona Ebner --- proxmox-notify/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[pve-devel] [PATCH many v2 00/20] notifications: move template strings to template files; PBS preparations

2024-04-19 Thread Lukas Wagner
noteworthy: Change template path from /usr/share/proxmox-ve to /usr/share/ - apart from that mostly just cosmetics/style proxmox: Lukas Wagner (12): notify: switch to file-based templating system notify: make api methods take config struct ownership notify: convert Option> -&g

Re: [pve-devel] [PATCH manager v5 08/16] api: notification: add API for getting known metadata fields/values

2024-04-19 Thread Lukas Wagner
On 2024-04-19 15:45, Fiona Ebner wrote: > Am 15.04.24 um 10:26 schrieb Lukas Wagner: >> + >> +__PACKAGE__->register_method ({ >> +name => 'get_field_values', >> +path => 'values', >> +method => 'GET', >> +descrip

Re: [pve-devel] [PATCH manager v5 05/16] api: replication: add 'replication-job' to notification metadata

2024-04-19 Thread Lukas Wagner
On 2024-04-19 15:11, Fiona Ebner wrote: > Am 19.04.24 um 14:22 schrieb Lukas Wagner: >> >> >> On 2024-04-19 14:02, Fiona Ebner wrote: >>> Am 15.04.24 um 10:26 schrieb Lukas Wagner: >>>> This allows users to create notification match rules for specifi

Re: [pve-devel] [PATCH proxmox 07/19] notify: api: add get_targets

2024-04-19 Thread Lukas Wagner
On 2024-04-19 10:34, Fiona Ebner wrote: > Am 09.04.24 um 15:25 schrieb Lukas Wagner: >> +/// Get a list of all notification targets. >> +pub fn get_targets(config: ) -> Result, HttpError> { >> +let mut targets = Vec::new(); >> + >> +#[cfg(fe

Re: [pve-devel] [PATCH proxmox 09/19] notify: derive Deserialize/Serialize for Notification struct

2024-04-19 Thread Lukas Wagner
On 2024-04-19 10:45, Fiona Ebner wrote: > Nit: I always like a quick sentence for who needs it for such changes. > > Am 09.04.24 um 15:25 schrieb Lukas Wagner: >> Signed-off-by: Lukas Wagner >> --- >> proxmox-notify/src/lib.rs | 10 +++--- >> 1 file chan

Re: [pve-devel] [PATCH manager v5 04/16] ui: dc: backup: allow to set custom job id in advanced settings

2024-04-19 Thread Lukas Wagner
On 2024-04-19 12:31, Fiona Ebner wrote: > Am 15.04.24 um 10:26 schrieb Lukas Wagner: >> This might be useful if somebody wants to match on the new >> 'backup-job' field in a notification match rule. >> >> Signed-off-by: Lukas Wagner >> --- >> www/

Re: [pve-devel] [PATCH manager v5 05/16] api: replication: add 'replication-job' to notification metadata

2024-04-19 Thread Lukas Wagner
On 2024-04-19 14:02, Fiona Ebner wrote: > Am 15.04.24 um 10:26 schrieb Lukas Wagner: >> This allows users to create notification match rules for specific >> replication jobs, if they so desire. >> >> Signed-off-by: Lukas Wagner >> --- >> PVE/API2/Repl

Re: [pve-devel] [PATCH many 00/19] notifications: move template strings to template files; PBS preparations

2024-04-19 Thread Lukas Wagner
On 2024-04-19 13:22, Fabian Grünbichler wrote: > On April 19, 2024 12:09 pm, Fiona Ebner wrote: >> Am 09.04.24 um 15:25 schrieb Lukas Wagner: >>> Bumps/dependencies: >>> - proxmox_notify >>> - libproxmox-rs-perl/libpve-rs-perl (needs bumped proxmox_n

Re: [pve-devel] [PATCH manager 19/19] notifications: use named templates instead of in-code templates

2024-04-19 Thread Lukas Wagner
On 2024-04-19 11:59, Fiona Ebner wrote: > Am 09.04.24 um 15:25 schrieb Lukas Wagner: >> diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm >> index 152eb3e5..2ea626f0 100644 >> --- a/PVE/VZDump.pm >> +++ b/PVE/VZDump.pm > > The existing $subject_template and $body_tem

Re: [pve-devel] [PATCH proxmox 01/19] notify: switch to file-based templating system

2024-04-19 Thread Lukas Wagner
On 2024-04-19 10:57, Fiona Ebner wrote: > Am 19.04.24 um 10:45 schrieb Lukas Wagner: >>> Who adds the template files? I don't see a patch for proxmox-ve in this >>> series. Does this series require some versioned breaks to some package? >> >> The pve-manage

Re: [pve-devel] [PATCH proxmox 01/19] notify: switch to file-based templating system

2024-04-19 Thread Lukas Wagner
On 2024-04-19 10:14, Fiona Ebner wrote: > Am 09.04.24 um 15:25 schrieb Lukas Wagner: >> Instead of passing the template strings for subject and body when >> constructing a notification, we pass only the name of a template. >> When rendering the template, the name of

[pve-devel] [PATCH manager v2 2/2] ui: one-off backup: show hint if notification-system is used

2024-04-15 Thread Lukas Wagner
When mode is 'auto' and 'mailto' is empty, show hint that the notification system will be used. Signed-off-by: Lukas Wagner Tested-by: Maximiliano Sandoval --- www/manager6/window/Backup.js | 37 +++ 1 file changed, 33 insertions(+), 4 deletions(-) diff --git

[pve-devel] [PATCH manager v2 1/2] ui: dc: backup: improve UX for the different 'notification-mode's

2024-04-15 Thread Lukas Wagner
- Switch order of 'mailto' and 'mailnotification' field - When mode is 'auto', disable 'mailtnotification' field - When mode is 'auto' and 'mailto' is empty, show hint that the notification system will be used Signed-off-by: Lukas Wagner Tested-by: Maximiliano Sandoval --- Notes

Re: [pve-devel] [PATCH manager 1/2] ui: dc: backup: improve UX for the different 'notification-mode's

2024-04-15 Thread Lukas Wagner
On 2024-04-11 09:44, Thomas Lamprecht wrote: >> Tested both commits, they do what they promise. >> >>> + let notificationSystemHint = Ext.create({ >>> + xtype: 'displayfield', >>> + padding: '0 0 0 5', >>> + userCls: 'pmx-hint', >>> + hidden: true, >>> + value:

[pve-devel] [PATCH widget-toolkit v5 11/16] notification: matcher: move match-field formulas to local viewModel

2024-04-15 Thread Lukas Wagner
This should make the code more cohesive and easier to follow. No functional changes. Signed-off-by: Lukas Wagner Tested-by: Maximiliano Sandoval --- src/window/NotificationMatcherEdit.js | 186 +- 1 file changed, 92 insertions(+), 94 deletions(-) diff --git a/src

[pve-devel] [PATCH widget-toolkit v5 12/16] notification: matcher: move match-calendar fields to panel

2024-04-15 Thread Lukas Wagner
Also introduce a local viewModel that is linked to a parent viewModel, allowing us to move the formulas to the panel. This should make the code more cohesive and easier to follow. No functional changes. Signed-off-by: Lukas Wagner Tested-by: Maximiliano Sandoval --- src/window

[pve-devel] [PATCH manager v5 08/16] api: notification: add API for getting known metadata fields/values

2024-04-15 Thread Lukas Wagner
This new API route returns known notification metadata fields and a list of known possible values. This will be used by the UI to provide suggestions when adding/modifying match rules. Signed-off-by: Lukas Wagner --- PVE/API2/Cluster/Notifications.pm | 152 ++ 1 file

[pve-devel] [PATCH docs v5 15/16] notifications: describe new notification metadata fields

2024-04-15 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- notifications.adoc | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/notifications.adoc b/notifications.adoc index 57053c8..0eeed6a 100644 --- a/notifications.adoc +++ b/notifications.adoc @@ -289,19 +289,22 @@ Notification

[pve-devel] [PATCH manager v5 09/16] ui: utils: add overrides for translatable notification fields/values

2024-04-15 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- www/manager6/Utils.js | 12 1 file changed, 12 insertions(+) diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index d4b5f3e6..c46ec4df 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -2052,6 +2052,18 @@ Ext.define

[pve-devel] [PATCH manager v5 06/16] vzdump: apt: notification: do not include domain in 'hostname' field

2024-04-15 Thread Lukas Wagner
in soft-breakage for any users who have already relied on the domain being present. If there is need for it, it could include a fqdn metadata field. The hostname property used for rendering the notification template is unaffected for now. Signed-off-by: Lukas Wagner --- PVE/API2/APT.pm | 3

[pve-devel] [PATCH docs v5 14/16] notification: clarify that 'hostname' does not include the domain

2024-04-15 Thread Lukas Wagner
This was a bit inconsistent between the different notification types: - APT/VZDump included the domain part - fence notifications did not A decision has been made to unify this by removing the domain part from APT/VZDump notifications. Signed-off-by: Lukas Wagner --- notifications.adoc | 2

[pve-devel] [PATCH widget-toolkit v5 10/16] notification: matcher: match-field: show known fields/values

2024-04-15 Thread Lukas Wagner
of known fields/values is retrieved from new API endpoints. Some values are marked 'internal' by the backend. This means that the 'value' field was not user-created (counter example: backup job IDs) and can therefore be used as a base for translations. Signed-off-by: Lukas Wagner Tested

[pve-devel] [PATCH widget-toolkit v5 13/16] notification: matcher: move match-severity fields to panel

2024-04-15 Thread Lukas Wagner
Also introduce a local viewModel that is linked to a parent viewModel, allowing us to move the formulas to the panel. This should make the code more cohesive and easier to follow. No functional changes. Signed-off-by: Lukas Wagner Tested-by: Maximiliano Sandoval --- src/window

[pve-devel] [PATCH docs v5 16/16] notifications: match-field 'exact'-mode can now match multiple values

2024-04-15 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- notifications.adoc | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/notifications.adoc b/notifications.adoc index 0eeed6a..912b048 100644 --- a/notifications.adoc +++ b/notifications.adoc @@ -221,11 +221,16 @@ configurable

[pve-devel] [PATCH manager v5 07/16] api: replication: include 'hostname' field for notifications

2024-04-15 Thread Lukas Wagner
The field contains the hostname of the host (without any domain part) which sends the notification. This field can be used in match-field match rules. Signed-off-by: Lukas Wagner --- PVE/API2/Replication.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PVE/API2/Replication.pm b/PVE/API2

[pve-devel] [PATCH manager v5 03/16] ui: dc: backup: send 'id' property when starting a backup job manually

2024-04-15 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- www/manager6/dc/Backup.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js index 70903bdc..4beb84c0 100644 --- a/www/manager6/dc/Backup.js +++ b/www/manager6/dc/Backup.js @@ -569,7 +569,6 @@ Ext.define

[pve-devel] [PATCH manager v5 02/16] api: jobs: vzdump: pass job 'id' parameter

2024-04-15 Thread Lukas Wagner
This allows us to access us the backup job id in the send_notification function, where we can set it as metadata for the notification. Signed-off-by: Lukas Wagner --- PVE/API2/VZDump.pm | 8 PVE/Jobs/VZDump.pm | 4 +++- PVE/VZDump.pm | 6 +++--- 3 files changed, 14 insertions

[pve-devel] [PATCH manager v5 01/16] api: notifications: add 'smtp' to target index

2024-04-15 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- PVE/API2/Cluster/Notifications.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Cluster/Notifications.pm b/PVE/API2/Cluster/Notifications.pm index 7047f0b1..68fdda2a 100644 --- a/PVE/API2/Cluster/Notifications.pm +++ b/PVE/API2

[pve-devel] [PATCH manager v5 05/16] api: replication: add 'replication-job' to notification metadata

2024-04-15 Thread Lukas Wagner
This allows users to create notification match rules for specific replication jobs, if they so desire. Signed-off-by: Lukas Wagner --- PVE/API2/Replication.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PVE/API2/Replication.pm b/PVE/API2/Replication.pm index 0dc944c9

[pve-devel] [PATCH manager v5 04/16] ui: dc: backup: allow to set custom job id in advanced settings

2024-04-15 Thread Lukas Wagner
This might be useful if somebody wants to match on the new 'backup-job' field in a notification match rule. Signed-off-by: Lukas Wagner --- www/manager6/Utils.js | 4 www/manager6/dc/Backup.js | 11 +++ 2 files changed, 15 insertions(+) diff --git a/www/manager6/Utils.js b

[pve-devel] [PATCH docs/manager/widget-toolkit v5 00/16] notifications: notification metadata matching improvements

2024-04-15 Thread Lukas Wagner
not possible to match them - include Maximilliano's T-b trailer in UI patches pve-manager: Lukas Wagner (9): api: notifications: add 'smtp' to target index api: jobs: vzdump: pass job 'id' parameter ui: dc: backup: send 'id' property when starting a backup job manually ui: dc: backup:

Re: [pve-devel] [RFC container/firewall/manager/proxmox-firewall/qemu-server 00/37] proxmox firewall nftables implementation

2024-04-10 Thread Lukas Wagner
On 2024-04-02 19:15, Stefan Hanreich wrote: > ## Introduction > This RFC provides a drop-in replacement for the current pve-firewall package > that is based on Rust and nftables. > > It consists of three crates: > * proxmox-ve-config > for parsing firewall and guest configuration files, as

Re: [pve-devel] [PATCH proxmox-firewall 09/37] config: firewall: add types for rules

2024-04-09 Thread Lukas Wagner
On 2024-04-03 12:46, Max Carrara wrote: >> + >> +#[derive(Clone, Debug)] >> +#[cfg_attr(test, derive(Eq, PartialEq))] >> +pub enum IcmpType { >> +Numeric(u8), >> +Named(&'static str), >> +} >> + >> +// MUST BE SORTED! > > Should maaaybe note that it must be sorted for binary search,

Re: [pve-devel] [PATCH proxmox-firewall 06/37] config: host: add helpers for host network configuration

2024-04-09 Thread Lukas Wagner
On 2024-04-02 19:15, Stefan Hanreich wrote: > Currently the helpers for obtaining the host network configuration > panic on error, which could be avoided by the use of > OnceLock::get_or_init, but this method is currently only available in > nightly versions. > > Generally, if there is a

Re: [pve-devel] [PATCH manager] Revert "ui: dc: remove notify key from datacenter option view"

2024-04-09 Thread Lukas Wagner
On 2024-04-09 15:07, Thomas Lamprecht wrote: > I'd propose two changes: > > - add a hint to redirect users to the new mechanisms so that a future > deprecation would be more expected (if we already plan that now) > > - only show it if defined? While that's a bit magic, it'd avoid that >

[pve-devel] [PATCH manager 19/19] notifications: use named templates instead of in-code templates

2024-04-09 Thread Lukas Wagner
This commit adapts notification sending for - package update - replication - backups to use named templates (installed in /usr/share/proxmox-ve/templates) instead of passing template strings defined in code to the notification stack. Signed-off-by: Lukas Wagner Tested-by: Folke

[pve-devel] [PATCH pve-ha-manager 16/19] env: notify: use named templates instead of passing template strings

2024-04-09 Thread Lukas Wagner
Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes --- debian/pve-ha-manager.install | 3 +++ src/Makefile | 1 + src/PVE/HA/Env/PVE2.pm| 4 ++-- src/PVE/HA/NodeStatus.pm | 20

[pve-devel] [PATCH proxmox 11/19] notify: renderer: add relative-percentage helper from PBS

2024-04-09 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- proxmox-notify/src/renderer/mod.rs | 29 + 1 file changed, 29 insertions(+) diff --git a/proxmox-notify/src/renderer/mod.rs b/proxmox-notify/src/renderer/mod.rs index a51ece6..ddb241d 100644 --- a/proxmox-notify/src/renderer/mod.rs

[pve-devel] [PATCH cluster 15/19] notify: use named template instead of passing template strings

2024-04-09 Thread Lukas Wagner
The notification system will now load template files from a defined location. The template to use is now passed to proxmox_notify, instead of separate template strings for subject/body. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes --- src/PVE/Notify.pm | 29

[pve-devel] [PATCH proxmox 05/19] notify: make the `mail-forwarder` feature depend on proxmox-sys

2024-04-09 Thread Lukas Wagner
It uses proxmox_sys::nodename - the dep is needed, otherwise the code does not compile in some feature flag permutations. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes --- proxmox-notify/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proxmox-notify

[pve-devel] [PATCH proxmox 01/19] notify: switch to file-based templating system

2024-04-09 Thread Lukas Wagner
' HTML/plaintext formatting. However, in hindsight this turned out to be pretty finicky. Since the current changes lay the foundations for user-customizable notification templates, I ripped these abstractions out. Now there are simply two templates, one for plaintext, one for HTML. Signed-off-by: Lukas

[pve-devel] [PATCH proxmox 08/19] notify: derive `api` for Deleteable*Property

2024-04-09 Thread Lukas Wagner
The API endpoints in Proxmox Backup Server require ApiType to be implemented for any deserialized parameter. Signed-off-by: Lukas Wagner --- proxmox-notify/src/endpoints/gotify.rs | 3 +++ proxmox-notify/src/endpoints/sendmail.rs | 7 +++ proxmox-notify/src/endpoints/smtp.rs | 9

[pve-devel] [PATCH proxmox 03/19] notify: convert Option> -> Vec in config structs

2024-04-09 Thread Lukas Wagner
Suggested-by: Wolfgang Bumiller Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes --- proxmox-notify/src/api/matcher.rs | 27 +++ proxmox-notify/src/api/mod.rs | 22 +--- proxmox-notify/src/api/sendmail.rs | 22 ++-- proxmox

[pve-devel] [PATCH proxmox 04/19] notify: don't make tests require pve-context

2024-04-09 Thread Lukas Wagner
Tests now have their own context, so requiring pve-context is not necessary any more. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes --- proxmox-notify/src/api/gotify.rs | 2 +- proxmox-notify/src/api/matcher.rs | 2 +- proxmox-notify/src/api/sendmail.rs | 2 +- proxmox-notify/src

[pve-devel] [PATCH proxmox-perl-rs 12/19] notify: use file based notification templates

2024-04-09 Thread Lukas Wagner
Instead of passing literal template strings to the notification system, we now only pass an identifier. This identifier will be used load the template files from a product-specific directory. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes --- common/src/notify.rs | 8 +++- 1 file

[pve-devel] [PATCH proxmox 09/19] notify: derive Deserialize/Serialize for Notification struct

2024-04-09 Thread Lukas Wagner
Signed-off-by: Lukas Wagner --- proxmox-notify/src/lib.rs | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/proxmox-notify/src/lib.rs b/proxmox-notify/src/lib.rs index 91c0b61..8d4dc63 100644 --- a/proxmox-notify/src/lib.rs +++ b/proxmox-notify/src/lib.rs @@ -159,11

[pve-devel] [PATCH proxmox 10/19] notify: pbs context: include nodename in default sendmail author

2024-04-09 Thread Lukas Wagner
The old notification stack in proxmox-backup includes the nodename, so we include it here as well. Signed-off-by: Lukas Wagner --- proxmox-notify/src/context/pbs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxmox-notify/src/context/pbs.rs b/proxmox-notify/src

[pve-devel] [PATCH proxmox 06/19] notify: give each notification a unique ID

2024-04-09 Thread Lukas Wagner
We need this for queuing notifications on PBS from the unprivileged proxy process. Signed-off-by: Lukas Wagner --- proxmox-notify/Cargo.toml | 1 + proxmox-notify/src/lib.rs | 11 +++ 2 files changed, 12 insertions(+) diff --git a/proxmox-notify/Cargo.toml b/proxmox-notify/Cargo.toml

[pve-devel] [PATCH proxmox 02/19] notify: make api methods take config struct ownership

2024-04-09 Thread Lukas Wagner
This saves us from some of the awkward cloning steps when updating. Suggested-by: Wolfgang Bumiller Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes --- proxmox-notify/src/api/gotify.rs | 46 +- proxmox-notify/src/api/matcher.rs | 38 +++ proxmox-notify/src

[pve-devel] [PATCH manager 18/19] tests: remove vzdump_notification test

2024-04-09 Thread Lukas Wagner
testing if the backup logs are shortened if they ware too long - so they are just removed. Signed-off-by: Lukas Wagner --- test/Makefile| 6 +- test/vzdump_notification_test.pl | 101 --- 2 files changed, 1 insertion(+), 106 deletions(-) delete

[pve-devel] [PATCH proxmox-perl-rs 13/19] notify: don't pass config structs by reference

2024-04-09 Thread Lukas Wagner
proxmox_notify's api functions have been changed so that they take ownership of config structs. Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes --- common/src/notify.rs | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/common/src/notify.rs b

[pve-devel] [PATCH proxmox-perl-rs 14/19] notify: adapt to Option> to Vec changes in proxmox_notify

2024-04-09 Thread Lukas Wagner
Signed-off-by: Lukas Wagner Tested-by: Folke Gleumes --- common/src/notify.rs | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/src/notify.rs b/common/src/notify.rs index 00a6056..e1b006b 100644 --- a/common/src/notify.rs +++ b/common/src/notify.rs

[pve-devel] [PATCH proxmox 07/19] notify: api: add get_targets

2024-04-09 Thread Lukas Wagner
This method allows us to get a list of all notification targets. Signed-off-by: Lukas Wagner --- proxmox-notify/src/api/mod.rs | 75 +++ 1 file changed, 75 insertions(+) diff --git a/proxmox-notify/src/api/mod.rs b/proxmox-notify/src/api/mod.rs index a2cf29e

  1   2   3   4   5   6   7   8   9   >