all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Michael Köppl" <m.koeppl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH FOLLOW-UP ha-manager 2/2] ha: decode JSON string with version info returned by get_node_kv
Date: Tue, 22 Jul 2025 18:54:28 +0200	[thread overview]
Message-ID: <20250722165428.90281-3-m.koeppl@proxmox.com> (raw)
In-Reply-To: <20250722165428.90281-1-m.koeppl@proxmox.com>

The version info entries for each node returned by get_node_kv are JSON
strings and need to be decoded to read the version of the node.

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
 src/PVE/HA/Env/PVE2.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index aecffc0..0ddc1ac 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -514,7 +514,9 @@ sub get_node_version {
 
     return undef if !$version_info->{$node};
 
-    return $version_info->{$node}->{version};
+    my $node_versioninfo = eval { decode_json($version_info->{$node}) };
+
+    return $node_versioninfo->{version};
 }
 
 1;
-- 
2.47.2



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

  parent reply	other threads:[~2025-07-22 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22 16:54 [pve-devel] [PATCH FOLLOW-UP ha-manager 0/2] fix errors during persistent migration of HA groups to rules Michael Köppl
2025-07-22 16:54 ` [pve-devel] [PATCH FOLLOW-UP ha-manager 1/2] config: use entire path to groups.cfg path in delete_group_config Michael Köppl
2025-07-22 16:54 ` Michael Köppl [this message]
2025-07-23 15:37 ` [pve-devel] [PATCH FOLLOW-UP ha-manager 0/2] fix errors during persistent migration of HA groups to rules Michael Köppl

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=20250722165428.90281-3-m.koeppl@proxmox.com \
    --to=m.koeppl@proxmox.com \
    --cc=pve-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