Skip to content

Commit

Permalink
DeleteDowntimesCommandForm: Ignore 404's
Browse files Browse the repository at this point in the history
fixes #5183
  • Loading branch information
nilmerg committed Feb 9, 2024
1 parent 58b3321 commit 9d84589
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Icinga\Module\Monitoring\Forms\Command\Object;

use Icinga\Module\Monitoring\Command\Object\DeleteDowntimeCommand;
use Icinga\Module\Monitoring\Exception\CommandTransportException;
use Icinga\Module\Monitoring\Forms\Command\CommandForm;
use Icinga\Web\Notification;

Expand Down Expand Up @@ -75,7 +76,15 @@ public function onSuccess()
->setDowntimeName($downtime->name)
->setAuthor($this->Auth()->getUser()->getUsername())
->setIsService(isset($downtime->service_description));
$this->getTransport($this->request)->send($delDowntime);

try {
$this->getTransport($this->request)->send($delDowntime);
} catch (CommandTransportException $e) {
// Negative lookahead because there may be messages from other endpoints with different status codes
if (preg_match('/Can\'t send external Icinga command: (?!404)/', $e->getMessage())) {
throw $e;
}
}
}
$redirect = $this->getElement('redirect')->getValue();
if (! empty($redirect)) {
Expand Down

0 comments on commit 9d84589

Please sign in to comment.