monitoring: Don't offer the Icinga 2 API as transport if cURL is missing

fixes #2661
This commit is contained in:
Johannes Meyer 2017-02-01 15:37:52 +01:00
parent e83e317cc6
commit 35ba15a7a6
4 changed files with 1186 additions and 1158 deletions

View File

@ -4,6 +4,7 @@
namespace Icinga\Module\Monitoring\Forms\Config; namespace Icinga\Module\Monitoring\Forms\Config;
use InvalidArgumentException; use InvalidArgumentException;
use Icinga\Application\Platform;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
use Icinga\Exception\NotFoundError; use Icinga\Exception\NotFoundError;
use Icinga\Forms\ConfigForm; use Icinga\Forms\ConfigForm;
@ -224,6 +225,9 @@ class TransportConfigForm extends ConfigForm
LocalCommandFile::TRANSPORT => $this->translate('Local Command File'), LocalCommandFile::TRANSPORT => $this->translate('Local Command File'),
RemoteCommandFile::TRANSPORT => $this->translate('Remote Command File') RemoteCommandFile::TRANSPORT => $this->translate('Remote Command File')
); );
if (! Platform::extensionLoaded('curl')) {
unset($transportTypes[ApiCommandTransport::TRANSPORT]);
}
$transportType = isset($formData['transport']) ? $formData['transport'] : null; $transportType = isset($formData['transport']) ? $formData['transport'] : null;
if ($transportType === null) { if ($transportType === null) {

View File

@ -212,6 +212,15 @@ class MonitoringWizard extends Wizard implements SetupWizard
))); )));
$backendSet->merge($pgsqlSet); $backendSet->merge($pgsqlSet);
$set->merge($backendSet); $set->merge($backendSet);
$set->add(new PhpModuleRequirement(array(
'optional' => true,
'condition' => 'curl',
'alias' => 'cURL',
'description' => mt(
'monitoring',
'To send external commands over Icinga 2\'s API the cURL module for PHP is required.'
)
)));
return $set; return $set;
} }