From: Thomas Lamprecht Date: Wed, 23 Jan 2019 12:42:11 +0000 (+0100) Subject: api: delete resource: refactor and cleanup indentation X-Git-Url: https://git.proxmox.com/?p=pve-ha-manager.git;a=commitdiff_plain;h=6b68528bc629d6a256fa0b36294d6dc512274b3e api: delete resource: refactor and cleanup indentation Signed-off-by: Thomas Lamprecht --- diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm index ee6f98e..8be6559 100644 --- a/src/PVE/API2/HA/Resources.pm +++ b/src/PVE/API2/HA/Resources.pm @@ -304,16 +304,13 @@ __PACKAGE__->register_method ({ die "cannot delete service '$sid', not HA managed!\n"; } - PVE::HA::Config::lock_ha_domain( - sub { - - $cfg = PVE::HA::Config::read_resources_config(); + PVE::HA::Config::lock_ha_domain(sub { - delete $cfg->{ids}->{$sid}; - - PVE::HA::Config::write_resources_config($cfg) + $cfg = PVE::HA::Config::read_resources_config(); + delete $cfg->{ids}->{$sid} or die "'$sid' not configured!\n"; + PVE::HA::Config::write_resources_config($cfg); - }, "delete resource failed"); + }, "delete resource failed"); return undef; }});