pveupdate is run daily by pve-daily-update.service and, among other
things, it tries to update the subscription. Updating a subscription
fails early when an offline key is installed, hence, pveupdate will
currently log the following to the syslog with severity level "error":

> update subscription info failed: Updating offline key not possible -
> please remove and re-add subscription key to switch to online key.

This may be confusing to users, because it sounds like an action is
needed on their part to resolve an error.

To avoid that, skip the subscription update if an offline key is
installed.

Reported in enterprise support.

Signed-off-by: Friedrich Weber <[email protected]>
---

Notes:
    This will result in pveupdate calling read_etc_subscription three times
    in the non-offline key case, which is certainly not optimal, but
    considering this is done once a day, maybe not that bad either, so I
    opted for this simple patch for now.

 bin/pveupdate | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bin/pveupdate b/bin/pveupdate
index c5356c88..50ca60a1 100755
--- a/bin/pveupdate
+++ b/bin/pveupdate
@@ -39,7 +39,13 @@ $rpcenv->set_user('root@pam');
 
 my $nodename = PVE::INotify::nodename();
 
-eval { PVE::API2::Subscription->update({ node => $nodename }); };
+eval {
+    my $subscription_info = PVE::API2::Subscription::read_etc_subscription();
+    return if !$subscription_info;
+    # no need to update offline subscription keys
+    return if $subscription_info->{signature};
+    PVE::API2::Subscription->update({ node => $nodename });
+};
 if (my $err = $@) {
     syslog('err', "update subscription info failed: $err");
 }
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to