all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v2] daily update: wire up subscription handling
Date: Wed,  3 Dec 2025 10:36:34 +0100	[thread overview]
Message-ID: <20251203093644.2896380-1-f.gruenbichler@proxmox.com> (raw)

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

             reply	other threads:[~2025-12-03  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03  9:36 Fabian Grünbichler [this message]
2025-12-03 12:08 ` Thomas Lamprecht

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=20251203093644.2896380-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal