From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 30FB21FF0A3 for ; Thu, 01 Oct 2026 10:41:28 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id CDA4F219A5; Thu, 01 Oct 2026 10:39:14 +0200 (CEST) From: Lukas Wagner To: pbs-devel@lists.proxmox.com, pve-devel@lists.proxmox.com Subject: [PATCH proxmox-perl-rs v2 28/34] notify: add 'migrate_to_expression' parameter for get_matcher Date: Thu, 1 Oct 2026 10:37:00 +0200 Message-ID: <20261001083706.144246-29-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261001083706.144246-1-l.wagner@proxmox.com> References: <20261001083706.144246-1-l.wagner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1790843857851 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.423 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: NFRMXLCVHSENASA65QGPEQOL44IAT73N X-Message-ID-Hash: NFRMXLCVHSENASA65QGPEQOL44IAT73N X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If set, we return the matcher with any occurrences of the 'old' match-*, invert-match and mode keys to an equivalent expression. Signed-off-by: Lukas Wagner --- pve-rs/src/bindings/notify.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pve-rs/src/bindings/notify.rs b/pve-rs/src/bindings/notify.rs index 820b8c0..da3c056 100644 --- a/pve-rs/src/bindings/notify.rs +++ b/pve-rs/src/bindings/notify.rs @@ -12,7 +12,7 @@ pub mod pve_rs_notify { use std::collections::HashMap; use std::sync::Mutex; - use anyhow::{bail, Error}; + use anyhow::{Error, bail}; use serde_json::Value as JSONValue; use perlmod::Value; @@ -33,7 +33,7 @@ pub mod pve_rs_notify { DeleteableWebhookProperty, WebhookConfig, WebhookConfigUpdater, }; use proxmox_notify::matcher::{DeleteableMatcherProperty, MatcherConfig, MatcherConfigUpdater}; - use proxmox_notify::{api, Config, Notification, Severity}; + use proxmox_notify::{Config, Notification, Severity, api}; /// A notification catalog instance. /// @@ -464,9 +464,15 @@ pub mod pve_rs_notify { pub fn get_matcher( #[try_from_ref] this: &NotificationConfig, id: &str, + migrate_to_expression: bool, ) -> Result { let config = this.config.lock().unwrap(); - api::matcher::get_matcher(&config, id) + + if migrate_to_expression { + api::matcher::get_matcher_as_expression(&config, id) + } else { + api::matcher::get_matcher(&config, id) + } } /// Method: Add a matcher. -- 2.47.3