public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] daily update: fix subscription check
Date: Thu, 22 Sep 2022 15:37:52 +0200	[thread overview]
Message-ID: <20220922133752.3367660-1-f.gruenbichler@proxmox.com> (raw)

this wrongly triggered for non-subscribed systems as well.

Fixes: dd16e1dac8976b523c1cf895efe280b73008eca6

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/bin/proxmox-daily-update.rs | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/bin/proxmox-daily-update.rs b/src/bin/proxmox-daily-update.rs
index 32c1d1ee..5332e217 100644
--- a/src/bin/proxmox-daily-update.rs
+++ b/src/bin/proxmox-daily-update.rs
@@ -2,6 +2,7 @@ use anyhow::Error;
 use serde_json::json;
 
 use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_subscription::SubscriptionStatus;
 use proxmox_sys::fs::CreateOptions;
 
 use proxmox_backup::api2;
@@ -32,16 +33,12 @@ async fn do_update(rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> {
         }
         _ => unreachable!(),
     }
-    let method = &api2::node::subscription::API_METHOD_GET_SUBSCRIPTION;
-    let notify = match method.handler {
-        ApiHandler::Sync(handler) => match (handler)(param, method, rpcenv) {
-            Ok(value) => !value.is_null(),
-            Err(err) => {
-                log::error!("Error reading subscription - {}", err);
-                false
-            }
+    let notify = match api2::node::subscription::get_subscription(param, rpcenv) {
+        Ok(info) => info.status == SubscriptionStatus::Active,
+        Err(err) => {
+            log::error!("Error reading subscription - {}", err);
+            false
         },
-        _ => unreachable!(),
     };
 
     let param = json!({
-- 
2.30.2





             reply	other threads:[~2022-09-22 13:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 13:37 Fabian Grünbichler [this message]
2022-09-23  5:58 ` [pbs-devel] applied: " 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=20220922133752.3367660-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pbs-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 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