From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 2F1091FF187
	for <inbox@lore.proxmox.com>; Mon, 26 May 2025 13:41:47 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 3954F3084E;
	Mon, 26 May 2025 13:41:58 +0200 (CEST)
From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Mon, 26 May 2025 13:41:38 +0200
Message-Id: <20250526114138.204228-1-l.wagner@proxmox.com>
X-Mailer: git-send-email 2.39.5
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.018 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [proxmox.com, config.rs, group.rs, filter.rs, lib.rs]
Subject: [pve-devel] [PATCH v2 proxmox] notify: remove legacy filters and
 groups
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

The notification system as we know it know underwent a serious overhaul
shortly before its initial release in PVE one year ago. Before the
overhaul, there were filters (the 'inverse' of a matchers as we know
them today) and groups (allowed one to send a notification to
multiple targets at once, they were replaced by being able to select
multiple targets in a matcher).

Unfortunately, this previous iteration of the notification was already
merged and packaged in the pvetest repository, resulting in an unknown
number of systems which may have already been using filters and groups.
To avoid breaking these systems when updating to the overhauled
notification system, we've kept the section config type
for both config sections. In anticipation of a future removal of these
section types, we proactively removed these entries when loading and
saving the notification config file.

With the upcoming release of PVE 9 and PBS 4 we can drop the
schema. The upgrade check scripts (e.g. pve8to9) will
include checks to make sure that no legacy config sections are present
any more.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---

Notes:
    Intended for the `master` branch.
    
    Changes since [v1]:
      - Rebased onto lastest master
    
    [v1]: https://lore.proxmox.com/pve-devel/20241202133256.207174-1-l.wagner@proxmox.com/

 proxmox-notify/src/config.rs | 42 +-----------------------------------
 proxmox-notify/src/filter.rs | 23 --------------------
 proxmox-notify/src/group.rs  | 23 --------------------
 proxmox-notify/src/lib.rs    |  2 --
 4 files changed, 1 insertion(+), 89 deletions(-)
 delete mode 100644 proxmox-notify/src/filter.rs
 delete mode 100644 proxmox-notify/src/group.rs

diff --git a/proxmox-notify/src/config.rs b/proxmox-notify/src/config.rs
index 791e0b5f..ec28c22c 100644
--- a/proxmox-notify/src/config.rs
+++ b/proxmox-notify/src/config.rs
@@ -1,12 +1,8 @@
 use std::sync::OnceLock;
 
-use tracing::warn;
-
 use proxmox_schema::{ApiType, ObjectSchema};
 use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
-use crate::filter::{FilterConfig, FILTER_TYPENAME};
-use crate::group::{GroupConfig, GROUP_TYPENAME};
 use crate::matcher::{MatcherConfig, MATCHER_TYPENAME};
 use crate::schema::BACKEND_NAME_SCHEMA;
 use crate::Error;
@@ -78,20 +74,6 @@ fn config_init() -> SectionConfig {
         MATCHER_SCHEMA,
     ));
 
-    const GROUP_SCHEMA: &ObjectSchema = GroupConfig::API_SCHEMA.unwrap_object_schema();
-    config.register_plugin(SectionConfigPlugin::new(
-        GROUP_TYPENAME.to_string(),
-        Some(String::from("name")),
-        GROUP_SCHEMA,
-    ));
-
-    const FILTER_SCHEMA: &ObjectSchema = FilterConfig::API_SCHEMA.unwrap_object_schema();
-    config.register_plugin(SectionConfigPlugin::new(
-        FILTER_TYPENAME.to_string(),
-        Some(String::from("name")),
-        FILTER_SCHEMA,
-    ));
-
     config
 }
 
@@ -140,32 +122,10 @@ fn private_config_init() -> SectionConfig {
 
 pub fn config(raw_config: &str) -> Result<(SectionConfigData, [u8; 32]), Error> {
     let digest = openssl::sha::sha256(raw_config.as_bytes());
-    let mut data = config_parser()
+    let data = config_parser()
         .parse("notifications.cfg", raw_config)
         .map_err(|err| Error::ConfigDeserialization(err.into()))?;
 
-    // TODO: Remove this once this has been in production for a while.
-    // 'group' and 'filter' sections are remnants of the 'old'
-    // notification routing approach that already hit pvetest...
-    // This mechanism cleans out left-over entries.
-    let entries: Vec<GroupConfig> = data.convert_to_typed_array("group").unwrap_or_default();
-    if !entries.is_empty() {
-        warn!("clearing left-over 'group' entries from notifications.cfg");
-    }
-
-    for entry in entries {
-        data.sections.remove(&entry.name);
-    }
-
-    let entries: Vec<FilterConfig> = data.convert_to_typed_array("filter").unwrap_or_default();
-    if !entries.is_empty() {
-        warn!("clearing left-over 'filter' entries from notifications.cfg");
-    }
-
-    for entry in entries {
-        data.sections.remove(&entry.name);
-    }
-
     Ok((data, digest))
 }
 
diff --git a/proxmox-notify/src/filter.rs b/proxmox-notify/src/filter.rs
deleted file mode 100644
index c9b152be..00000000
--- a/proxmox-notify/src/filter.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-use serde::{Deserialize, Serialize};
-
-use proxmox_schema::api;
-
-use crate::schema::ENTITY_NAME_SCHEMA;
-
-pub(crate) const FILTER_TYPENAME: &str = "filter";
-
-#[api(
-    properties: {
-        name: {
-            schema: ENTITY_NAME_SCHEMA,
-        },
-    },
-    additional_properties: true,
-)]
-#[derive(Debug, Serialize, Deserialize, Default)]
-#[serde(rename_all = "kebab-case")]
-/// Config for the old filter system - can be removed at some point.
-pub struct FilterConfig {
-    /// Name of the group
-    pub name: String,
-}
diff --git a/proxmox-notify/src/group.rs b/proxmox-notify/src/group.rs
deleted file mode 100644
index 46458dbe..00000000
--- a/proxmox-notify/src/group.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-use serde::{Deserialize, Serialize};
-
-use proxmox_schema::api;
-
-use crate::schema::ENTITY_NAME_SCHEMA;
-
-pub(crate) const GROUP_TYPENAME: &str = "group";
-
-#[api(
-    properties: {
-        name: {
-            schema: ENTITY_NAME_SCHEMA,
-        },
-    },
-    additional_properties: true,
-)]
-#[derive(Debug, Serialize, Deserialize, Default)]
-#[serde(rename_all = "kebab-case")]
-/// Config for the old target groups - can be removed at some point.
-pub struct GroupConfig {
-    /// Name of the group
-    pub name: String,
-}
diff --git a/proxmox-notify/src/lib.rs b/proxmox-notify/src/lib.rs
index 38d21618..879f8326 100644
--- a/proxmox-notify/src/lib.rs
+++ b/proxmox-notify/src/lib.rs
@@ -22,8 +22,6 @@ pub mod api;
 pub mod config;
 pub mod context;
 pub mod endpoints;
-pub mod filter;
-pub mod group;
 pub mod renderer;
 pub mod schema;
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel