Commit 0ac59534 authored by Navid Sassan's avatar Navid Sassan
Browse files

fixed another problem with the datalist import

parent 85e7e026
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Icinga\Module\Director\Objects; namespace Icinga\Module\Director\Objects;
use Icinga\Exception\NotFoundError;
use Icinga\Module\Director\Core\Json; use Icinga\Module\Director\Core\Json;
use Icinga\Module\Director\Data\Db\DbObjectWithSettings; use Icinga\Module\Director\Data\Db\DbObjectWithSettings;
use Icinga\Module\Director\Db; use Icinga\Module\Director\Db;
...@@ -77,11 +78,15 @@ class DirectorDatafield extends DbObjectWithSettings ...@@ -77,11 +78,15 @@ class DirectorDatafield extends DbObjectWithSettings
$plain->settings = (object) $this->getSettings(); $plain->settings = (object) $this->getSettings();
if (property_exists($plain->settings, 'datalist_id')) { if (property_exists($plain->settings, 'datalist_id')) {
$plain->settings->datalist = DirectorDatalist::loadWithAutoIncId( // It is possible that the datalist does not exists yet, but is part of the new basket
$plain->settings->datalist_id, try {
$this->getConnection() $plain->settings->datalist = DirectorDatalist::loadWithAutoIncId(
)->get('list_name'); $plain->settings->datalist_id,
unset($plain->settings->datalist_id); $this->getConnection()
)->get('list_name');
} catch (NotFoundError $e) {
}
unset($plain->settings->datalist_id);
} }
return $plain; return $plain;
......
Name: Icinga Director Name: Icinga Director
Version: 1.7.2.2020020402 Version: 1.7.2.2020020403
Depends: reactbundle (>=0.7.0), ipl (>=0.3.0), incubator (>=0.5.0) Depends: reactbundle (>=0.7.0), ipl (>=0.3.0), incubator (>=0.5.0)
Description: Director - Config tool for Icinga 2 Description: Director - Config tool for Icinga 2
Icinga Director is a configuration tool that has been designed to make Icinga Director is a configuration tool that has been designed to make
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment