ceph versions: do not try to parse empty string

Might not be expected to happen but never makes sense to try here, if
we can then broadcast the correct version info anyway.

Might be related to an error reported in the forum [0].

[0]: https://forum.proxmox.com/threads/bug-invalid-json.164835/

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2025-04-10 09:21:08 +02:00
parent 2777e05cb8
commit 326ff3b1c6

View File

@ -54,7 +54,7 @@ sub broadcast_ceph_versions {
my $nodename = PVE::INotify::nodename();
my $old_versions = PVE::Cluster::get_node_kv("ceph-versions", $nodename);
if (defined(my $old_version_raw = $old_versions->{$nodename})) {
if (length(my $old_version_raw = $old_versions->{$nodename})) {
my $old = eval { decode_json($old_version_raw) };
warn "failed to parse ceph-versions '$old_version_raw' as JSON - $@" if $@; # should not happen
if (defined($old) && $old->{buildcommit} eq $buildcommit && $old->{version}->{str} eq $version) {