public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Michael Köppl" <m.koeppl@proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: j.klocker@proxmox.com
Subject: [PATCH test-tools 1/3] instance: pve client: add helper for the API certificate fingerprint
Date: Thu, 26 Nov 2026 18:59:13 +0100	[thread overview]
Message-ID: <20261126175915.2833652-2-m.koeppl@proxmox.com> (raw)
In-Reply-To: <20261126175915.2833652-1-m.koeppl@proxmox.com>

Registering PDM remotes needs the fingerprint of every node it lists,
so move the lookup of the pve-ssl.pem certificate next to the request
that fetches it.

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
 proxmox-test-instance/src/api/pve_client.rs       | 10 ++++++++++
 proxmox-test-instance/src/instance_manager/mod.rs | 13 ++-----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/proxmox-test-instance/src/api/pve_client.rs b/proxmox-test-instance/src/api/pve_client.rs
index 4e4c1f47..4eddcb2d 100644
--- a/proxmox-test-instance/src/api/pve_client.rs
+++ b/proxmox-test-instance/src/api/pve_client.rs
@@ -996,6 +996,16 @@ impl PveClient {
         Ok(data)
     }
 
+    /// The fingerprint of the certificate the API of `node` presents.
+    pub async fn api_fingerprint(&self, node: &str) -> Result<Option<String>, Error> {
+        let certs = self.get_certificates(node).await?;
+        let cert = certs
+            .iter()
+            .find(|c| c.filename == "pve-ssl.pem")
+            .with_context(|| format!("failed to get certificate for node {node}"))?;
+        Ok(cert.fingerprint.clone())
+    }
+
     fn client(&self) -> &Client {
         &self.client.0
     }
diff --git a/proxmox-test-instance/src/instance_manager/mod.rs b/proxmox-test-instance/src/instance_manager/mod.rs
index 53dee7dd..c3fbd0d7 100644
--- a/proxmox-test-instance/src/instance_manager/mod.rs
+++ b/proxmox-test-instance/src/instance_manager/mod.rs
@@ -1161,17 +1161,8 @@ systemctl list-unit-files --type=timer --state=enabled --no-legend | grep daily
                                     self.secret_resolver.resolve(&instance.root_password)?;
                                 let client =
                                     PveClient::new_with_creds(&url, "root@pam", &secret).await?;
-                                let certs = client.get_certificates(&instance.nodename).await?;
-                                let cert = certs
-                                    .iter()
-                                    .find(|c| c.filename == "pve-ssl.pem")
-                                    .with_context(|| {
-                                        format!(
-                                            "failed to get certificate for node {}",
-                                            instance.nodename
-                                        )
-                                    })?;
-                                instance.fingerprint = cert.fingerprint.clone();
+                                instance.fingerprint =
+                                    client.api_fingerprint(&instance.nodename).await?;
                                 pdm_client.add_remote(&instance, &secret).await?;
                                 Ok(instance.fingerprint.clone())
                             })
-- 
2.47.3





  reply	other threads:[~2026-11-26 17:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 17:59 [PATCH test-tools 0/3] register clusters with PDM after forming them Michael Köppl
2026-11-26 17:59 ` Michael Köppl [this message]
2026-11-26 17:59 ` [PATCH test-tools 2/3] instance: move the grouping of instances by cluster into a helper Michael Köppl
2026-11-26 17:59 ` [PATCH test-tools 3/3] instance: setup: register clusters with PDM after forming them Michael Köppl

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=20261126175915.2833652-2-m.koeppl@proxmox.com \
    --to=m.koeppl@proxmox.com \
    --cc=j.klocker@proxmox.com \
    --cc=pve-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