public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox-backup] api: node: replace trivial config change detection helper
@ 2026-04-07  7:50 Christian Ebner
  0 siblings, 0 replies; only message in thread
From: Christian Ebner @ 2026-04-07  7:50 UTC (permalink / raw)
  To: pbs-devel

Commit 1bab5905 ("pbs-config: refactor and move helper to detect
config digest changes") moved the previous helper to detect config
file changes. The DNS node config used its own helper for this.

Remove that and use the common helper instead to align with the rest
of the codebase.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 src/api2/node/dns.rs | 7 +++----
 src/tools/mod.rs     | 9 +--------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/api2/node/dns.rs b/src/api2/node/dns.rs
index 7065401ea..9ed73396d 100644
--- a/src/api2/node/dns.rs
+++ b/src/api2/node/dns.rs
@@ -3,6 +3,7 @@ use std::sync::{Arc, LazyLock, Mutex};
 use ::serde::{Deserialize, Serialize};
 use anyhow::Error;
 use const_format::concatcp;
+use hex::FromHex;
 use openssl::sha;
 use regex::Regex;
 use serde_json::{json, Value};
@@ -134,11 +135,9 @@ pub fn update_dns(
     let _guard = MUTEX.lock();
 
     let mut config = read_etc_resolv_conf()?;
-    let old_digest = config["digest"].as_str().unwrap();
+    let old_digest = <[u8; 32]>::from_hex(config["digest"].as_str().unwrap())?;
 
-    if let Some(digest) = digest {
-        crate::tools::assert_if_modified(old_digest, &digest)?;
-    }
+    pbs_config::detect_modified_configuration_file(digest, &old_digest)?;
 
     if let Some(delete) = delete {
         for delete_prop in delete {
diff --git a/src/tools/mod.rs b/src/tools/mod.rs
index a31ae6c46..89b62f9a6 100644
--- a/src/tools/mod.rs
+++ b/src/tools/mod.rs
@@ -2,7 +2,7 @@
 //!
 //! This is a collection of small and useful tools.
 
-use anyhow::{bail, Error};
+use anyhow::Error;
 use std::collections::HashSet;
 
 use pbs_api_types::{
@@ -21,13 +21,6 @@ pub mod ticket;
 
 pub mod parallel_handler;
 
-pub fn assert_if_modified(digest1: &str, digest2: &str) -> Result<(), Error> {
-    if digest1 != digest2 {
-        bail!("detected modified configuration - file changed by other user? Try again.");
-    }
-    Ok(())
-}
-
 /// The default 2 hours are far too long for PBS
 pub const PROXMOX_BACKUP_TCP_KEEPALIVE_TIME: u32 = 120;
 pub const DEFAULT_USER_AGENT_STRING: &str = "proxmox-backup-client/1.0";
-- 
2.47.3





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-07  7:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-07  7:50 [PATCH proxmox-backup] api: node: replace trivial config change detection helper Christian Ebner

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