BasketSnapshot: do not export external objects
This commit is contained in:
parent
50dd49c937
commit
1d550cd442
|
@ -5,6 +5,7 @@ namespace Icinga\Module\Director\DirectorObject\Automation;
|
||||||
use Icinga\Module\Director\Core\Json;
|
use Icinga\Module\Director\Core\Json;
|
||||||
use Icinga\Module\Director\Db;
|
use Icinga\Module\Director\Db;
|
||||||
use Icinga\Module\Director\Data\Db\DbObject;
|
use Icinga\Module\Director\Data\Db\DbObject;
|
||||||
|
use Icinga\Module\Director\Objects\IcingaCommand;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
|
@ -241,13 +242,18 @@ class BasketSnapshot extends DbObject
|
||||||
protected function addAll($typeName)
|
protected function addAll($typeName)
|
||||||
{
|
{
|
||||||
$class = static::getClassForType($typeName);
|
$class = static::getClassForType($typeName);
|
||||||
/** @var ExportInterface $object */
|
|
||||||
if (static::classWantsTemplate($class)) {
|
|
||||||
/** @var IcingaObject $dummy */
|
/** @var IcingaObject $dummy */
|
||||||
$dummy = $class::create();
|
$dummy = $class::create();
|
||||||
|
/** @var ExportInterface $object */
|
||||||
|
if ($dummy instanceof IcingaObject && $dummy->supportsImports()) {
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
|
if ($dummy instanceof IcingaCommand) {
|
||||||
|
$select = $db->select()->from($dummy->getTableName())
|
||||||
|
->where('object_type != ?', 'external_object');
|
||||||
|
} else {
|
||||||
$select = $db->select()->from($dummy->getTableName())
|
$select = $db->select()->from($dummy->getTableName())
|
||||||
->where('object_type = ?', 'template');
|
->where('object_type = ?', 'template');
|
||||||
|
}
|
||||||
$all = $class::loadAll($this->getConnection(), $select);
|
$all = $class::loadAll($this->getConnection(), $select);
|
||||||
} else {
|
} else {
|
||||||
$all = $class::loadAll($this->getConnection());
|
$all = $class::loadAll($this->getConnection());
|
||||||
|
|
Loading…
Reference in New Issue