ImportSourceCoreApi: import flapping only for 2.8+

fixes #1652
This commit is contained in:
Thomas Gelf 2018-11-14 13:34:39 +01:00
parent 9aab203f59
commit 4352264b73
2 changed files with 9 additions and 6 deletions

View File

@ -515,7 +515,7 @@ constants
public function getHostObjects()
{
return $this->getDirectorObjects('Host', 'hosts', [
$params = [
'display_name' => 'display_name',
'address' => 'address',
'address6' => 'address6',
@ -534,7 +534,6 @@ constants
'enable_flapping' => 'enable_flapping',
'enable_perfdata' => 'enable_perfdata',
'event_command' => 'event_command',
'flapping_threshold' => 'flapping_threshold',
'volatile' => 'volatile',
'zone' => 'zone',
'command_endpoint' => 'command_endpoint',
@ -543,7 +542,14 @@ constants
'action_url' => 'action_url',
'icon_image' => 'icon_image',
'icon_image_alt' => 'icon_image_alt',
]);
];
if (version_compare($this->getVersion(), '2.8.0', '>=')) {
$params['flapping_threshold_high'] = 'flapping_threshold_high';
$params['flapping_threshold_low'] = 'flapping_threshold_low';
}
return $this->getDirectorObjects('Host', 'hosts', $params);
}
public function getHostGroupObjects()

View File

@ -4,10 +4,7 @@ namespace Icinga\Module\Director\Import;
use Icinga\Application\Config;
use Icinga\Module\Director\Db;
use Icinga\Module\Director\Core\CoreApi;
use Icinga\Module\Director\Core\RestApiClient;
use Icinga\Module\Director\Hook\ImportSourceHook;
use Icinga\Module\Director\Util;
use Icinga\Module\Director\Web\Form\QuickForm;
class ImportSourceCoreApi extends ImportSourceHook