[pve-devel] [PATCH pve-ha-manager] fix 'state' default value when returning config in API

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Sep 10 08:21:41 CEST 2015


as we default to 'enabled' when a service state isn't explicitly
set, use this default when returning the config. So default values
stay in the package and others which rely on the API don't have to
make assumptions.

Fixes bug where the HA ResourceEditor sometimes shows a wrong state
enabled checkbox.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/API2/HA/Resources.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm
index 354b7b6..f512926 100644
--- a/src/PVE/API2/HA/Resources.pm
+++ b/src/PVE/API2/HA/Resources.pm
@@ -32,6 +32,7 @@ my $api_copy_config = sub {
     my $scfg = dclone($cfg->{ids}->{$sid});
     $scfg->{sid} = $sid;
     $scfg->{digest} = $cfg->{digest};
+    $scfg->{state} = 'enabled' if !defined($scfg->{state});
 
     return $scfg;
 };
-- 
2.1.4




More information about the pve-devel mailing list