all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v2 2/4] tools: factor out node proxy config read helper
Date: Wed, 11 Mar 2026 10:59:04 +0100	[thread overview]
Message-ID: <20260311095906.202410-5-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260311095906.202410-1-c.ebner@proxmox.com>

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@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





  parent reply	other threads:[~2026-03-11  9:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11  9:59 [PATCH proxmox{,-backup} v2 0/6] fix #6716: Add support for http proxy configuration for S3 endpoints Christian Ebner
2026-03-11  9:59 ` [PATCH proxmox v2 1/2] pbs-api-types: make operation non-optional for maintenance-mode check Christian Ebner
2026-03-11  9:59 ` [PATCH proxmox v2 2/2] s3-client: add proxy configuration as optional client option Christian Ebner
2026-03-11  9:59 ` [PATCH proxmox-backup v2 1/4] datastore: make operation non-optional in lookups Christian Ebner
2026-03-11  9:59 ` Christian Ebner [this message]
2026-03-11  9:59 ` [PATCH proxmox-backup v2 3/4] datastore: refactor datastore lookup parameters into dedicated type Christian Ebner
2026-03-11  9:59 ` [PATCH proxmox-backup v2 4/4] fix #6716: pass node http proxy config to s3 backend Christian Ebner
2026-03-12 11:43 ` [PATCH proxmox{,-backup} v2 0/6] fix #6716: Add support for http proxy configuration for S3 endpoints Christian Ebner

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=20260311095906.202410-5-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal