]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
api: delete resource: refactor and cleanup indentation
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 23 Jan 2019 12:42:11 +0000 (13:42 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 26 Jan 2019 11:05:07 +0000 (12:05 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/API2/HA/Resources.pm

index ee6f98eb8322a7894a3974bc733fa38d02b7d6b9..8be655903afc1b41fae282507352dface73acdcf 100644 (file)
@@ -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;
     }});