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

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 ...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..f0bfcd5 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);
 
+    pdm_config::remotes::init(Box::new(pdm_config::remotes::DefaultRemoteConfig));
     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

* [pdm-devel] NACK: [PATCH datacenter-manager] daily update: wire up subscription handling
  2025-12-03  9:28 [pdm-devel] [PATCH datacenter-manager] daily update: wire up subscription handling Fabian Grünbichler
@ 2025-12-03  9:35 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2025-12-03  9:35 UTC (permalink / raw)
  To: Proxmox Datacenter Manager development discussion

On December 3, 2025 10:28 am, Fabian Grünbichler wrote:
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
>  ...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..f0bfcd5 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);
>  
> +    pdm_config::remotes::init(Box::new(pdm_config::remotes::DefaultRemoteConfig));

this needs to be a context init call, else it fails if there are remotes configured..

>      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
> 


_______________________________________________
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  9:34 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:28 [pdm-devel] [PATCH datacenter-manager] daily update: wire up subscription handling Fabian Grünbichler
2025-12-03  9:35 ` [pdm-devel] NACK: " Fabian Grünbichler

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