public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH datacenter-manager v2] daily update: wire up subscription handling
@ 2025-12-03  9:36 Fabian Grünbichler
  2025-12-03 12:08 ` Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2025-12-03  9:36 UTC (permalink / raw)
  To: pdm-devel

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    v2: initialize server context instead of just remote config

 ...proxmox-datacenter-manager-daily-update.rs | 27 +++++++++----------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/server/src/bin/proxmox-datacenter-manager-daily-update.rs b/server/src/bin/proxmox-datacenter-manager-daily-update.rs
index 43ad538..ad29c2c 100644
--- a/server/src/bin/proxmox-datacenter-manager-daily-update.rs
+++ b/server/src/bin/proxmox-datacenter-manager-daily-update.rs
@@ -3,7 +3,7 @@ use serde_json::json;
 
 //use proxmox_notify::context::pbs::PBS_CONTEXT;
 use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
-//use proxmox_subscription::SubscriptionStatus;
+use proxmox_subscription::SubscriptionStatus;
 use proxmox_sys::fs::CreateOptions;
 
 use server::api;
@@ -23,25 +23,21 @@ async fn wait_for_local_worker(upid_str: &str) -> Result<(), Error> {
 
 /// Daily update
 async fn do_update(rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> {
-    /*
-    let param = json!({});
-    let method = &api::node::subscription::API_METHOD_CHECK_SUBSCRIPTION;
-    match method.handler {
-        ApiHandler::Sync(handler) => {
-            if let Err(err) = (handler)(param.clone(), method, rpcenv) {
-                log::error!("Error checking subscription - {err}");
-            }
-        }
-        _ => unreachable!(),
+    if let Err(err) = &api::nodes::subscription::check_subscription().await {
+        log::error!("Error checking subscription - {err}");
     }
-    let notify = match api::node::subscription::get_subscription(param, rpcenv) {
-        Ok(info) => info.status == SubscriptionStatus::Active,
+    match api::nodes::subscription::get_subscription().await {
+        Ok(info) if info.info.status == SubscriptionStatus::Active => {}
+        Ok(info) => {
+            log::warn!(
+                "Subscription not active: {status}",
+                status = info.info.status
+            )
+        }
         Err(err) => {
             log::error!("Error reading subscription - {err}");
-            false
         }
     };
-    */
 
     println!("updating apt package database");
     let param = json!({
@@ -102,6 +98,7 @@ async fn run(rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> {
 
     //proxmox_notify::context::set_context(&PBS_CONTEXT);
 
+    server::context::init()?;
     do_update(rpcenv).await
 }
 
-- 
2.47.3



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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pdm-devel] [PATCH datacenter-manager v2] daily update: wire up subscription handling
  2025-12-03  9:36 [pdm-devel] [PATCH datacenter-manager v2] daily update: wire up subscription handling Fabian Grünbichler
@ 2025-12-03 12:08 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-12-03 12:08 UTC (permalink / raw)
  To: pdm-devel, Fabian Grünbichler

On Wed, 03 Dec 2025 10:36:34 +0100, Fabian Grünbichler wrote:
> 


Applied, thanks!

[1/1] daily update: wire up subscription handling
      commit: d2f8e4025fbe92e2a28a1741a893d8dced030a3d


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-03 12:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-03  9:36 [pdm-devel] [PATCH datacenter-manager v2] daily update: wire up subscription handling Fabian Grünbichler
2025-12-03 12:08 ` Thomas Lamprecht

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