From 1ffea41bedb7aa1f1d6405b7d0e2e421c7e16b21 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 6 Mar 2014 18:35:44 +0000 Subject: [PATCH] Fix instance config error handling in CommandController --- .../application/controllers/CommandController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/monitoring/application/controllers/CommandController.php b/modules/monitoring/application/controllers/CommandController.php index a50c9e056..143c8d431 100644 --- a/modules/monitoring/application/controllers/CommandController.php +++ b/modules/monitoring/application/controllers/CommandController.php @@ -139,7 +139,7 @@ class Monitoring_CommandController extends ActionController public function init() { if ($this->_request->isPost()) { - $instance = $this->_request->getPost("instance"); + $instance = $this->_request->getPost('instance'); $targetConfig = Config::module('monitoring', 'instances'); if ($instance) { if ($targetConfig->get($instance)) { @@ -148,12 +148,11 @@ class Monitoring_CommandController extends ActionController throw new ConfigurationError('Instance is not configured: '. $instance); } } else { - $targetInfo = $targetConfig->current(); // Take the very first section - - if ($targetInfo === false) { - throw new ConfigurationError("No instances are configured yet"); - } else { + if ($targetConfig && $targetInfo = $targetConfig->current()) { + // Take the very first section $this->target = new CommandPipe($targetInfo); + } else { + throw new ConfigurationError('No instances are configured yet'); } } } @@ -351,6 +350,7 @@ class Monitoring_CommandController extends ActionController */ public function reschedulenextcheckAction() { + $this->addTitleTab('Reschedule Next Check'); $this->setSupportedParameters(array('host', 'service')); $form = new RescheduleNextCheckForm(); $form->setRequest($this->getRequest());