KickstartHelper: friendlier error message...

...when unable to delete

fixes #2206
This commit is contained in:
Thomas Gelf 2020-11-30 07:21:43 +01:00
parent 1d514640dd
commit 797560beb5
2 changed files with 19 additions and 2 deletions

View File

@ -68,6 +68,9 @@ next (will be 1.8.0)
### Authentication and Permissions ### Authentication and Permissions
* FIX: Users restricted to Hostgroups can now use related Templates (#2020, #2101) * FIX: Users restricted to Hostgroups can now use related Templates (#2020, #2101)
### Kickstart
* FEATURE: Friendlier message if object to be removed is still in use (#2206)
### Icinga Configuration ### Icinga Configuration
* FIX: Correctly render Service Dependencies with Array-style parent hosts (#2088) * FIX: Correctly render Service Dependencies with Array-style parent hosts (#2088)
* REMOVED: magic-apply-for (a hidden deprecated feature) has been removed (#1851) * REMOVED: magic-apply-for (a hidden deprecated feature) has been removed (#1851)

View File

@ -280,7 +280,14 @@ class KickstartHelper
protected function removeZones() protected function removeZones()
{ {
foreach ($this->removeZones as $zone) { foreach ($this->removeZones as $zone) {
try {
$zone->delete(); $zone->delete();
} catch (Exception $e) {
throw new Exception(sprintf(
"Failed to remove external Zone '%s', it's eventually still in use",
$zone->getObjectName()
), 0, $e);
}
} }
return $this; return $this;
@ -339,7 +346,14 @@ class KickstartHelper
protected function removeEndpoints() protected function removeEndpoints()
{ {
foreach ($this->removeEndpoints as $endpoint) { foreach ($this->removeEndpoints as $endpoint) {
try {
$endpoint->delete(); $endpoint->delete();
} catch (Exception $e) {
throw new Exception(sprintf(
"Failed to remove external Endpoint '%s', it's eventually still in use",
$endpoint->getObjectName()
), 0, $e);
}
} }
return $this; return $this;