]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
allow empty json status files
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 18 Jul 2016 12:02:42 +0000 (14:02 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 22 Jul 2016 10:14:01 +0000 (12:14 +0200)
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>
src/PVE/HA/Config.pm

index c9aa8a53d866f409e1704db6b2de182b3837b337..00b338d62f91342d6201539233c2114327ce2e83 100644 (file)
@@ -38,7 +38,7 @@ cfs_register_file($ha_fence_config,
 sub json_reader {
     my ($filename, $data) = @_;
 
-    return defined($data) ? decode_json($data) : {};
+    return defined($data) && length($data) > 0 ? decode_json($data) : {};
 }
 
 sub json_writer {