From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup] api: node: replace trivial config change detection helper
Date: Tue, 7 Apr 2026 09:50:03 +0200 [thread overview]
Message-ID: <20260407075003.161713-1-c.ebner@proxmox.com> (raw)
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
reply other threads:[~2026-04-07 7:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260407075003.161713-1-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox