Merge branch 'bugfix/can-t-configure-monitoring-backend-when-none-were-configured-11392'

fixes #11392
This commit is contained in:
Alexander A. Klimov 2016-04-26 12:56:11 +02:00
commit 8461cfafd8
1 changed files with 8 additions and 3 deletions

View File

@ -8,8 +8,9 @@ use Icinga\Data\ResourceFactory;
use Icinga\Exception\ConfigurationError;
use Icinga\Exception\NotFoundError;
use Icinga\Forms\ConfirmRemovalForm;
use Icinga\Web\Controller;
use Icinga\Web\Notification;
use Icinga\Module\Monitoring\Controller;
use Icinga\Module\Monitoring\Backend;
use Icinga\Module\Monitoring\Forms\Config\BackendConfigForm;
use Icinga\Module\Monitoring\Forms\Config\SecurityConfigForm;
use Icinga\Module\Monitoring\Forms\Config\TransportConfigForm;
@ -199,7 +200,9 @@ class ConfigController extends Controller
$form->setRedirectUrl('monitoring/config');
$form->setTitle(sprintf($this->translate('Edit Command Transport %s'), $transportName));
$form->setIniConfig($this->Config('commandtransports'));
$form->setInstanceNames($this->backend->select()->from('instance', array('instance_name'))->fetchColumn());
$form->setInstanceNames(
Backend::createBackend()->select()->from('instance', array('instance_name'))->fetchColumn()
);
$form->setOnSuccess(function (TransportConfigForm $form) use ($transportName) {
try {
$form->edit($transportName, array_map(
@ -241,7 +244,9 @@ class ConfigController extends Controller
$form->setRedirectUrl('monitoring/config');
$form->setTitle($this->translate('Create New Command Transport'));
$form->setIniConfig($this->Config('commandtransports'));
$form->setInstanceNames($this->backend->select()->from('instance', array('instance_name'))->fetchColumn());
$form->setInstanceNames(
Backend::createBackend()->select()->from('instance', array('instance_name'))->fetchColumn()
);
$form->setOnSuccess(function (TransportConfigForm $form) {
try {
$form->add(array_filter($form->getValues()));