From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 1/2] server: subscription: always get fresh subscription info on update
Date: Wed, 3 Jun 2026 13:54:41 +0200 [thread overview]
Message-ID: <20260603115442.361184-2-s.sterz@proxmox.com> (raw)
In-Reply-To: <20260603115442.361184-1-s.sterz@proxmox.com>
otherwise the cached information is used. since the cache does not
include the server id, not suitable information will be detected. to
avoid that freshly fetch the subscription info, including the server
id, when updating the subscription status.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
server/src/api/nodes/subscription.rs | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/server/src/api/nodes/subscription.rs b/server/src/api/nodes/subscription.rs
index d6ae48b5..4ab36c36 100644
--- a/server/src/api/nodes/subscription.rs
+++ b/server/src/api/nodes/subscription.rs
@@ -163,12 +163,35 @@ pub async fn check_subscription() -> Result<(), Error> {
if info.status == SubscriptionStatus::Active
&& info.level >= SubscriptionLevel::Basic
&& info.key.is_some()
- && info.serverid.is_some()
{
log::info!(
"Using subscription of node '{node}' of remote '{remote}' for enterprise \
repository access"
);
+
+ // Get fresh subscription info. The cache does not store the serverid, so we
+ // need to fetch it from the remote. This has the upside of always yielding
+ // fresh results.
+ let (remote_config, _digest) = pdm_config::remotes::config()?;
+ let Some(remote) = remote_config.get(remote) else {
+ continue 'outer;
+ };
+ let node_info = get_subscription_info_for_remote(remote, 0).await?;
+ let Some(info) = node_info.iter().find_map(|(_key, val)| {
+ if let Some(info) = val.as_ref() {
+ if info.status == SubscriptionStatus::Active
+ && info.level >= SubscriptionLevel::Basic
+ && info.key.is_some()
+ && info.serverid.is_some()
+ {
+ return Some(info.clone());
+ }
+ }
+ None
+ }) else {
+ continue 'outer;
+ };
+
update_apt_auth(
APT_AUTH_FN,
apt_auth_file_opts(),
--
2.47.3
next prev parent reply other threads:[~2026-06-03 11:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 11:54 [PATCH datacenter-manager 0/2] fix an issue with cached subscription info Shannon Sterz
2026-06-03 11:54 ` Shannon Sterz [this message]
2026-06-03 11:54 ` [PATCH datacenter-manager 2/2] server: cache: short-circuit on special max age value 0 Shannon Sterz
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=20260603115442.361184-2-s.sterz@proxmox.com \
--to=s.sterz@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 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.