public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 1/3] server: adapt to proxmox-client compat mode changes
Date: Mon, 29 Sep 2025 17:48:18 +0200	[thread overview]
Message-ID: <20250929154820.892720-5-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250929154820.892720-1-c.ebner@proxmox.com>

Adapt to the method name and type changes for setting the client
login compatibility mode.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 server/src/connection.rs | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/server/src/connection.rs b/server/src/connection.rs
index 2eda452..5530812 100644
--- a/server/src/connection.rs
+++ b/server/src/connection.rs
@@ -19,7 +19,9 @@ use openssl::x509::X509StoreContextRef;
 use serde::Serialize;
 
 use proxmox_acme_api::CertificateInfo;
-use proxmox_client::{Client, HttpApiClient, HttpApiResponse, HttpApiResponseStream, TlsOptions};
+use proxmox_client::{
+    Client, CompatMode, HttpApiClient, HttpApiResponse, HttpApiResponseStream, TlsOptions,
+};
 
 use pdm_api_types::remotes::{NodeUrl, Remote, RemoteType, TlsProbeOutcome};
 use pve_api_types::client::PveClientImpl;
@@ -32,21 +34,21 @@ static INSTANCE: OnceLock<Box<dyn ClientFactory + Send + Sync>> = OnceLock::new(
 struct ConnectInfo {
     prefix: String,
     perl_compat: bool,
-    pve_compat: bool,
+    compat_mode: CompatMode,
     default_port: u16,
 }
 
 impl ConnectInfo {
     fn for_remote(remote: &Remote) -> Self {
-        let (prefix, perl_compat, pve_compat) = match remote.ty {
-            RemoteType::Pve => ("PVEAPIToken".to_string(), true, true),
-            RemoteType::Pbs => ("PBSAPIToken".to_string(), false, false),
+        let (prefix, perl_compat, compat_mode) = match remote.ty {
+            RemoteType::Pve => ("PVEAPIToken".to_string(), true, CompatMode::PveTfa),
+            RemoteType::Pbs => ("PBSAPIToken".to_string(), false, CompatMode::Generic),
         };
 
         ConnectInfo {
             prefix,
             perl_compat,
-            pve_compat,
+            compat_mode,
             default_port: remote.ty.default_port(),
         }
     }
@@ -56,7 +58,7 @@ impl ConnectInfo {
 fn prepare_connect_client_to_node(
     node: &NodeUrl,
     default_port: u16,
-    pve_compat: bool,
+    compat_mode: CompatMode,
 ) -> Result<Client, Error> {
     let mut options = TlsOptions::default();
 
@@ -75,7 +77,7 @@ fn prepare_connect_client_to_node(
 
     let mut client =
         proxmox_client::Client::with_options(uri.clone(), options, Default::default())?;
-    client.set_pve_compatibility(pve_compat);
+    client.set_compatibility(compat_mode);
     Ok(client)
 }
 
@@ -99,7 +101,7 @@ fn prepare_connect_client(
 
     let info = ConnectInfo::for_remote(remote);
 
-    let client = prepare_connect_client_to_node(node, info.default_port, info.pve_compat)?;
+    let client = prepare_connect_client_to_node(node, info.default_port, info.compat_mode)?;
 
     Ok((client, info))
 }
@@ -135,7 +137,7 @@ fn prepare_connect_multi_client(remote: &Remote) -> Result<(MultiClient, Connect
             client: Arc::new(prepare_connect_client_to_node(
                 node,
                 info.default_port,
-                info.pve_compat,
+                info.compat_mode,
             )?),
             hostname: node.hostname.clone(),
         });
-- 
2.47.3



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


  parent reply	other threads:[~2025-09-29 15:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29 15:48 [pdm-devel] [PATCH datacenter-manager/proxmox 0/6] pbs client: fix PBS version 3 login ticket parsing compatibility Christian Ebner
2025-09-29 15:48 ` [pdm-devel] [PATCH proxmox 1/3] proxmox-login: refactor PVE TFA compat mode Christian Ebner
2025-09-29 15:48 ` [pdm-devel] [PATCH proxmox 2/3] proxmox-client: adapt to new compat mode introduced for proxmox-login Christian Ebner
2025-09-29 15:48 ` [pdm-devel] [PATCH proxmox 3/3] proxmox-login: add compat mode to fallback to PBS3 ticket parsing Christian Ebner
2025-09-29 18:01   ` Christian Ebner
2025-09-29 15:48 ` Christian Ebner [this message]
2025-09-29 15:48 ` [pdm-devel] [PATCH datacenter-manager 2/3] server: pbs-client: check and fallback to PBS v3 ticket compat mode Christian Ebner
2025-09-29 15:48 ` [pdm-devel] [PATCH datacenter-manager 3/3] Revert "ui: add wizard: note that login currently only works for PBS 4" Christian Ebner
2025-09-30  8:03 ` [pdm-devel] superseded: [PATCH datacenter-manager/proxmox 0/6] pbs client: fix PBS version 3 login ticket parsing compatibility 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=20250929154820.892720-5-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pdm-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal