public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 proxmox] notify: remove legacy filters and groups
@ 2025-05-26 11:41 Lukas Wagner
  2025-05-26 14:01 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wagner @ 2025-05-26 11:41 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH v2 proxmox] notify: remove legacy filters and groups
  2025-05-26 11:41 [pve-devel] [PATCH v2 proxmox] notify: remove legacy filters and groups Lukas Wagner
@ 2025-05-26 14:01 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-05-26 14:01 UTC (permalink / raw)
  To: pve-devel, Lukas Wagner

On Mon, 26 May 2025 13:41:38 +0200, Lukas Wagner wrote:
> 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).
> 
> [...]

Applied, thanks!

[1/1] notify: remove legacy filters and groups
      commit: 58696c15270ad411a8664c46117760eb2aa9b42b


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-26 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-26 11:41 [pve-devel] [PATCH v2 proxmox] notify: remove legacy filters and groups Lukas Wagner
2025-05-26 14:01 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal