Else we crash fatally on an existing but empty status file like
/etc/pve/manager_status , reproducible with:
$ > /etc/pve/ha/manager_status
We do not want to catch arbitrary errors as then users cannot
reconstruct what happened in the event of an error.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
sub json_reader {
my ($filename, $data) = @_;
- return defined($data) ? decode_json($data) : {};
+ return defined($data) && length($data) > 0 ? decode_json($data) : {};
}
sub json_writer {