From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 0AC411FF179 for ; Wed, 15 Oct 2025 14:47:12 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B404A1B1BB; Wed, 15 Oct 2025 14:47:26 +0200 (CEST) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Date: Wed, 15 Oct 2025 14:47:08 +0200 Message-ID: <20251015124711.312943-10-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251015124711.312943-1-l.wagner@proxmox.com> References: <20251015124711.312943-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1760532437803 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH proxmox-datacenter-manager 09/12] remote updates: add support for PBS remotes X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" The 'update_apt_database' function starts a new tracked remote task. The remote task infrastructure needs a bit more work to work with PBS UPIDs, so the code is commented out for now. Signed-off-by: Lukas Wagner --- server/src/api/pbs/mod.rs | 15 ++++++++++++++- server/src/remote_updates.rs | 37 +++++++++++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/server/src/api/pbs/mod.rs b/server/src/api/pbs/mod.rs index dc31f620..b3bb126c 100644 --- a/server/src/api/pbs/mod.rs +++ b/server/src/api/pbs/mod.rs @@ -9,13 +9,17 @@ use proxmox_sortable_macro::sortable; use pdm_api_types::remotes::{ NodeUrl, Remote, RemoteListEntry, RemoteType, TlsProbeOutcome, REMOTE_ID_SCHEMA, }; -use pdm_api_types::{Authid, HOST_OPTIONAL_PORT_FORMAT, PRIV_RESOURCE_AUDIT, PRIV_SYS_MODIFY}; +use pdm_api_types::{ + Authid, RemoteUpid, HOST_OPTIONAL_PORT_FORMAT, PRIV_RESOURCE_AUDIT, PRIV_SYS_MODIFY, +}; use crate::{ connection::{self, probe_tls_connection}, pbs_client::{self, get_remote, PbsClient}, }; +use crate::remote_tasks; + mod rrddata; pub const ROUTER: Router = Router::new() @@ -65,6 +69,15 @@ const DATASTORE_ITEM_SUBDIRS: SubdirMap = &sorted!([ ), ]); +// converts a remote + pbs_api_types::UPID into a RemoteUpid and starts tracking it +pub async fn new_remote_upid( + remote: String, + upid: pbs_api_types::UPID, +) -> Result { + let remote_upid = remote_tasks::track_running_pbs_task(remote, upid).await?; + Ok(remote_upid) +} + #[api( returns: { type: Array, diff --git a/server/src/remote_updates.rs b/server/src/remote_updates.rs index ab5845bd..4c70495b 100644 --- a/server/src/remote_updates.rs +++ b/server/src/remote_updates.rs @@ -14,7 +14,6 @@ use pdm_api_types::remotes::{Remote, RemoteType}; use pdm_api_types::RemoteUpid; use pdm_buildcfg::PDM_CACHE_DIR_M; -use crate::api::pve::new_remote_upid; use crate::connection; use crate::parallel_fetcher::{NodeResults, ParallelFetcher}; @@ -64,9 +63,22 @@ pub async fn update_apt_database(remote: &Remote, node: &str) -> Result { + // let client = connection::make_pbs_client(remote)?; + // + // let params = crate::pbs_client::AptUpdateParams { + // notify: Some(false), + // quiet: Some(false), + // }; + // let upid = client.update_apt_database(params).await?; + // + // crate::api::pbs::new_remote_upid(remote.id.clone(), upid).await + // TODO: task infrastructure for PBS not finished yet, uncomment once + // this is done. + bail!("PBS is not supported yet"); } - RemoteType::Pbs => bail!("PBS is not supported yet"), } } @@ -81,7 +93,14 @@ pub async fn get_changelog(remote: Remote, node: &str, package: String) -> Resul .await .map_err(Into::into) } - RemoteType::Pbs => bail!("PBS is not supported yet"), + RemoteType::Pbs => { + let client = connection::make_pbs_client(&remote)?; + + client + .get_package_changelog(package, None) + .await + .map_err(Into::into) + } } } @@ -249,7 +268,15 @@ async fn fetch_available_updates( updates, }) } - RemoteType::Pbs => bail!("PBS is not supported yet"), + RemoteType::Pbs => { + let client = connection::make_pbs_client(&remote)?; + let updates = client.list_available_updates().await?; + + Ok(NodeUpdateInfo { + last_refresh: proxmox_time::epoch_i64(), + updates, + }) + } } } -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel