[pbs-devel] [PATCH proxmox-backup 2/4] tools: factor out node proxy config read helper

Christian Ebner c.ebner at proxmox.com
Thu Jan 22 16:11:23 CET 2026


Will be reused for getting the node proxy config to set it for the
s3-client as well.

No functional changes.

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

diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs
index c696adb1e..dd92e9f48 100644
--- a/src/api2/node/apt.rs
+++ b/src/api2/node/apt.rs
@@ -15,8 +15,6 @@ use proxmox_sys::fs::{replace_file, CreateOptions};
 
 use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_AUDIT, PRIV_SYS_MODIFY, UPID_SCHEMA};
 
-use crate::config::node;
-
 #[api(
     input: {
         properties: {
@@ -59,11 +57,7 @@ pub fn update_apt_proxy_config(proxy_config: Option<&ProxyConfig>) -> Result<(),
 }
 
 fn read_and_update_proxy_config() -> Result<Option<ProxyConfig>, Error> {
-    let proxy_config = if let Ok((node_config, _digest)) = node::config() {
-        node_config.http_proxy()
-    } else {
-        None
-    };
+    let proxy_config = crate::tools::node_proxy_config();
     update_apt_proxy_config(proxy_config.as_ref())?;
 
     Ok(proxy_config)
diff --git a/src/tools/mod.rs b/src/tools/mod.rs
index 6a975bde2..93b4d8ea4 100644
--- a/src/tools/mod.rs
+++ b/src/tools/mod.rs
@@ -13,6 +13,8 @@ use proxmox_http::{client::Client, HttpOptions, ProxyConfig};
 use pbs_datastore::backup_info::{BackupDir, BackupInfo};
 use pbs_datastore::manifest::BackupManifest;
 
+use crate::config::node;
+
 pub mod config;
 pub mod disks;
 pub mod fs;
@@ -186,3 +188,12 @@ pub(crate) fn backup_info_to_snapshot_list_item(
         }
     }
 }
+
+/// Read the nodes http proxy config from the node config.
+pub(super) fn node_proxy_config() -> Option<proxmox_http::ProxyConfig> {
+    if let Ok((node_config, _digest)) = node::config() {
+        node_config.http_proxy()
+    } else {
+        None
+    }
+}
-- 
2.47.3





More information about the pbs-devel mailing list